A Visitor to my site came from google looking for "c# personal attribute to an html tag". If I understand this query correctly then the person is trying to add an attribute to an already created HTML object. However, this might not be the case, so I will include in this entry a few different ways of adding attibutes to HTML elements via C#.
To do this from C#, if you are rendering out a serverside control you could simply have the following:
HtmlGenericControl b = new HtmlGenericControl("b");
The above code might add a control to the page which is a "b" tag and that will look like: <b id="testB" kinlaniscool="false">
If you wanted to do something similar in a custom server control, I might do the following:
protected override void Render(HtmlTextWriter output)
Basically all we are doing in the above code is overriding how the control renders its data. It will render a B tag with all the correct attributes.
And that is about it.
Trying to make the web and developers better.