我有一个 ASP.NET DropDownList
从数据库中的列中检索名字和姓氏的控件。我希望有三个,而不是名字和姓氏之间只有一个空格。如何在 DropDownList
中的两段文本之间添加额外的空格? ?
最佳答案
添加 而不是空格字符和 html解码绑定(bind)后的所有元素:
string[] items = new string[] {
"name& nbsp;& nbsp;& nbsp;surname1",
"name& nbsp;& nbsp;& nbsp;surname2" };
ddl.DataSource = items;
ddl.DataBind();
foreach (ListItem item in ddl.Items)
{
item.Text = HttpUtility.HtmlDecode(item.Text);
}
关于asp.net - 在 ASP.NET DropDownList 控件中插入 'space',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1422250/