utilitaire
Regular
- Joined
- May 4, 2005
- Messages
- 77
I have a file Templates.config that contains templates for my controls:
I first put all these attributes in a list. This is Easy. After that, I want to merge these attributes to my current server control. Its goes like this:
I can do that. The probleme comes with composed style. For instance: "AlternatingItemStyle-BackColor". I can't use this propertyName since its not ONE property. At this point, I find this buntch of code very complicated and I'm sure there a parser somewhere in ASP.NET that can do that for me. Have you ever heard of something that can do that? After all, asp.net has to parse all theses attributes when it loads the server control.
Thank you
Code:
<Template>
<add Id="myTemplateDataGrid"
Type="DataGridPreset"
HeaderStyle-BackColor="#ffffff"
BorderWidth="0"
BackColor="#EEFBF0"
GridLines="None"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="14pt"
AlternatingItemStyle-BackColor="#DEF8E2"
AutoGenerateColumns="false"
/>
</Template>
I first put all these attributes in a list. This is Easy. After that, I want to merge these attributes to my current server control. Its goes like this:
Code:
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(myDataGrid);
properties["borderwith"].SetValue(myDataGrid, 2);
I can do that. The probleme comes with composed style. For instance: "AlternatingItemStyle-BackColor". I can't use this propertyName since its not ONE property. At this point, I find this buntch of code very complicated and I'm sure there a parser somewhere in ASP.NET that can do that for me. Have you ever heard of something that can do that? After all, asp.net has to parse all theses attributes when it loads the server control.
Thank you