The Attributes Collection of a control is a collection of all HTML
attributes of that control. In the following HTML, note the attributes:
<input type="text" size="1" name="MyText">
The attributes of this HTML object are "type", "size", and "name".
All Server Controls have an Attributes collection. Whenther an attribute
performs the way you expect it to is a function of HTML and the browser, not
of ASP.Net. You can add any attribute you want to an HTML element. The
browser may or may not recognize it and interact with it. For example, you
could create an extra attribute for the text box above, and call it "foo":
<input type="text" size="1" name="MyText" foo="bar">
You wouldn't expect a browser to do anything with that, would you? So, make
sure that the attribute you add to a Server Control is a valid HTML
attribute for that HTML object.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Janaka" <ja****@magicalia.com> wrote in message
news:#6*************@TK2MSFTNGP09.phx.gbl...
I've seen and used some samples where you can set the onclick attrubute to
a Button control to get it to do some javascript a la :
btnUse.Attributes["onclick"] = "DoSomeJS()";
However when i try and get this to work on certain controls such as the
ListItem in a RadioButtonList it just doesn't do anything? Does this
attributes property only render for certain controls?