Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以告诉我在 asp.net 网络表单中是否类似于TagWindows 表单中的属性。 我想将一些数据绑定到控件,以便稍后我能够识别它们而无需添加很多。if(...) { } 更具体地说,我想在构建 sql 时使用该标签,selectcommand这些标签就像:c.City, c.Country并且它会被绑定到checkboxlists
Tag
if(...) { }
selectcommand
c.City, c.Country
checkboxlists
你能发明你自己的属性吗?
<asp:CheckBoxList ID="CheckBoxList1" runat="server" MyAttribute="Country" > </asp:CheckBoxList>
然后在代码隐藏中:
string myatt = CheckBoxList1.Attributes["MyAttribute"]; switch (myatt) { case "Country": CheckBoxList1.DataSource = ... etc
这是你要找的吗?