【发布时间】:2013-08-07 03:44:57
【问题描述】:
我正在使用以下方法将自定义属性添加到复选框:
CheckBox chkBx = new CheckBox();
chkBx.ID = "chk" + n;
chkBx.Attributes["itemname"] = strtemPath;
但结果我得到了以下 HTML:
<span itemname="Some folder"><input id="MainContent_chk0" type="checkbox" name="MasterPg$MainContent$chk0" /></span>
我期待这个:
<input id="MainContent_chk0" type="checkbox" name="MasterPg$MainContent$chk0" itemname="Some folder" />
知道如何更正 C# 代码以获得我的预期结果吗?
【问题讨论】:
标签: c# html asp.net web-applications