Adding custom attributes to web.form controls RRS feed

  • Question

  • User628169361 posted

    Hey everyone,

    I would like to add some custom attributes to form controls (label, textbox, combo, checkbox and other controls like this), to automatically bind them to my own database.


    <asp:TextBox runat="server" .....
    xTable="users" xField="userName" meta:tags="do u think meta tags could help here"></asp:TextBox>

     So, first how can I add those attributes, and secondly how do I iterate through them.

    foreach (var c in form.controls)

          how to get the attributes here...

     thanks for any kind of help...

    Monday, June 8, 2009 4:39 AM


  • User628169361 posted

      I do not want to develop (server or) custom controls for this one.

     Looks like I am gonna be answering my own post.

    textbox1.Attributes["xField"] returns "userName";

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 8, 2009 6:12 AM

All replies