你可以用runat="server"的 Html control实现你的要求:
......
protected System,Web.UI.HtmlControls.HtmlInputCheckBox chkBox;
......chkBox.Attributes["myAttribute"]="kevin";
......
protected System,Web.UI.HtmlControls.HtmlInputCheckBox chkBox;
......chkBox.Attributes["myAttribute"]="kevin";
<asp:CheckBox id="chkBox" runat="server" myAttribute="kevin">结果生成的html也是:
<span myAttribute='kevin'><input type=checkbox id=chkBox onclick="clickFunc();"></span>惨。
chkBox.Attributes.AddAttributes(myHtmlTextWriter);test...
在aspx页面文件中是:
<input id="chkBox" type="checkbox" runat="server">