Last post Nov 15, 2007 04:14 PM by enriverd
Nov 15, 2007 09:16 AM|enriverd|LINK
I was wondering if there is any way of retrieveing custrom html attributes assigned to a control, but that do not match any property. For example, let's say y create a label like:
string str=" <asp:Label ID="Label1" runat="server" localizationResourceKey="KEY"/>";
Is there any way to get the value for the localizationResourceKey programaticaly if I have access to the ctrl variable? I need that as a workaroung for my previous post about the implicit localization of dynamic controls...
If I get to retrieve the localizationResourceKey, then I can apply the localization programaticaly, as the meta:resourcekey does not work with ParseControl.
Nov 15, 2007 04:14 PM|enriverd|LINK
Hi! I finally managed myself to guess how. The WebControl and HtmlControl have a Property called Attributes which stores those attributes that do not belong to the control, so I just had to cast the Control class to either WebControl or HtmlControl, the
appropriate one. And that's all!
I'm posting the solution sot hat anyone else can benefit from it!