c# - 在 DropDownList 中添加分隔符

标签 c# asp.net

我有一个场景,我必须在 asp.net 的 DropDownList 中添加分隔符。请提出建议。

最佳答案

你可以使用禁用的项目作为分隔符

例子:

ListItem separator = new ListItem("---element---", "");
separator.Attributes.Add("disabled", "true");
ddltest.Items.Add(separator);

关于c# - 在 DropDownList 中添加分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4861033/

相关文章:

java - jQuery 没有加载源 aspx 页面

c# - 单元测试中的 OpenRasta 模拟 HttpContext

c# - Backgroundworker Sleep 以减少 CPU

javascript - 使用 CKEditor 4.5 使用 FileBrowser 回调代替弹出窗口

c# - 如何解析具有不同目录级别的页面的 javascript 路径?

html - 由于 CSS 类,DIV 不在 IE8 中显示

C# 将 View 状态转换为 bool 数组

c# - 如何在 WPF DataGrid 列中制作互斥复选框

C# MySQLCommand批量更新失败

javascript - 将信息添加到按钮上的 txt 文件单击 ASP.NET