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
<CustomControl>
<MyTemplate>
<Mappings id="Mapping1" prop1="1" prop2="2"/>
<Mappings id="Mapping2" prop1="4" prop2="2"/>
</MyTemplate>
</CustomControl>
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>" />
</cc2:CustomControl>
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?