Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a file Templates.config that contains templates for my controls:

 


<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:

 


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...