Mon*_*RPG 11 c# asp.net field c#-4.0 drop-down-menu
下面我可以设置值和文字:
dropListUserImages.DataValueField = "Value";
dropListUserImages.DataTextField = "Text";
dropListUserImages.Items.Add(new ListItem { Text = srText, Value = srValue});
Run Code Online (Sandbox Code Playgroud)
我还想设置额外的属性,例如:
data-imagesrc
data-description
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
Nix*_*Nix 17
使用:
ListItem test = new ListItem { Text = srText, Value = srValue}
test.Attributes.Add("data-imagesrc", "xxx");
test.Attributes.Add("data-description", "xxx");
dropListUserImages.Items.Add(test);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17118 次 |
| 最近记录: |