Creating a WebServer control to save its state RRS feed

  • Question

  • User-84895304 posted

    Hi Everyone,
    I have a control that has a property called mappings to be set at designtime.
    I want to save the mappings in the format specified below

    <Mappings id="Mapping1" prop1="1" prop2="2"/>
    <Mappings id="Mapping2" prop1="4" prop2="2"/>

    Is it possible to save all my mappings as custom tags (Mappings) with attributes "prop1" and "prop2" ?

    My Approach so far:

    1. I am trying to define a simple template called MyTemplate
    2. Get each mapping information as XML (serialized) and save only the field values of the mapping object in hiddenfield

    <cc2:CustomControl ID="CustomControl1" runat="server">
    <asp:HiddenField ID="HiddenField1" runat="server" Value="<wheels>4</wheels><driverName>Tony</driverName>" />

    3.Retrieve the information in XML at runtime from hidden field and the convert into objects of my custom class.

    Is my approach correct?
    Can anyone suggest the best way to do it?

    Monday, July 7, 2008 3:03 AM


All replies

  • User481221548 posted


    Yep, thats possible. Look at the enumeration "PersistenceMode":

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 7, 2008 4:57 AM
  • User-84895304 posted

    Thanks a lot Peter.

    I was able to get it.

    Can we set them using custom UI Editor?

    Because my custom tags dont get set when I use a custom UI Editor to set it.



    Tuesday, July 8, 2008 8:35 AM
  • User481221548 posted

    Hi Tony

    You mean a "ControlDesigner" Class for your Control?
    If, then: How is your ControlDesigner implemented?
    Please show relevant code.

    And how is the fail-behavior?
    please describe more in detail.

    Tuesday, July 8, 2008 4:01 PM