Damien Guard mentioned a couple of times how that he hated ASP.NET's 'ID mangling': based on the hierarchy of containers, ASP.NET renders a unique ID to ensure that you don't have to worry about ID's on the client being globally unique. This was problematic for him with relation to external applications which sometimes require you to use specific ID's to let them 'integrate'. While I understand that ASP.NET probably tries to target the 99% case, I can also see that this may be problematic in a few cases. And it doesn't exactly seem to be trivial to enforce that the specified ID is the ID that is rendered.
That's why I extended the Wilco.Web ASP.NET library with an IDOverride control. It lets you specify which controls should render their ID as is. Please use this with caution, since you can now use multiple controls with the same ID, and all you would get is unexpected results.
Here's what it looks like:
1
2
3
4
5
6
7
8
9
|
<asp:Content ContentPlaceHolderID="main">
<asp:TextBox ID="userName" Runat="server" />
<asp:TextBox ID="password" Runat="server" TextMode="Password">
<WilcoWeb:IDOverride runat="server">
<WilcoWeb:Override TargetControlID="userName" />
<WilcoWeb:Override TargetControlID="password" />
</WilcoWeb:IDOverride>
</asp:Content>
|