Reputation: 907
I am trying to get the name of check boxes so that i can group all check boxes with the same name, i have tried cb.Name
(cb
is a object of type HtmlInputCheckBox
) this only returns the id, i also have tried cb.Attributes["name"]
which also gives nothing. Not sure any other ways to get the name attribute of a check box any body else have an idea?
Upvotes: 1
Views: 324
Reputation: 3675
If you want to work around the way ASP.NET renders the name attribute, you might want to remove the runat="server"
from the input tags in your markup. That way the tags will be rendered as they are in the markup an won't be processed by the HtmlInputCheckBox class. You can get the values of the checkbox by using Request.Form["nameOfCheckbox"]
in a postback event.
Upvotes: 1