Add custom attribute to an HTML input element with C#
I'm using the following method to add a custom attribute to a check box:
CheckBox chkBx = new CheckBox();
chkBx.ID = "chk" + n;
chkBx.Attributes["itemname"] = strtemPath;
But as a result I'm getting the following HTML:
<span itemname="Some folder"><input id="MainContent_chk0" type="checkbox"
name="MasterPg$MainContent$chk0" /></span>
where I'm expecting this:
<input id="MainContent_chk0" type="checkbox"
name="MasterPg$MainContent$chk0" itemname="Some folder" />
Any idea how to correct the C# code to get my expected result?
No comments:
Post a Comment