本文介绍了如何将下拉列表转换为下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将下拉列表转换为下拉列表,所以基本上列表中的项目仍然相同,但应该有复选框。先谢谢。 以下是它的样子: timg092191.wordpress / 2013/08/16 / ddcl / [ ^ ] 这是代码: 来自AddUser4.aspx
I need to convert my dropdown list to a dropdown checklist, so basically the item on the list is still the same but should have checkboxes on them. Thanks in advanced. Here's how it looks like: timg092191.wordpress/2013/08/16/ddcl/[^] Here's the code: From AddUser4.aspx
<asp:DropDownList ID="drpSchoolOffice" runat="server" Width="200px"> </asp:DropDownList>来自AddUser4.aspx.cs
From AddUser4.aspx.cs
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { drpSchoolOffice.Items.Clear(); dtOffice = blSchool.loadSchoolAll(); if (dtOffice.Rows.Count > 0) { foreach (DataRow r in dtOffice.Rows) { drpSchoolOffice.Items.Add(r[2].ToString()); } } SortedList slst = new SortedList(); foreach (ListItem li in drpSchoolOffice.Items) { slst.Add(li.Text, li.Value); } drpSchoolOffice.DataSource = slst; drpSchoolOffice.DataValueField = "Value"; drpSchoolOffice.DataTextField = "Key"; drpSchoolOffice.DataBind(); catch { Response.Redirect("~/index.aspx"); } } }推荐答案
dropdowncheckboxes.codeplex/ [ ^ ]
您已经有很多与您的要求相关的文章,其中一个可能是 www.dotnetspeaks/DisplayArticle.aspx?ID=63 [ ^ ] You have already many articles related to your requirement one of those might be www.dotnetspeaks/DisplayArticle.aspx?ID=63[^]
Refer - ASP.NET中的多选DropDownlist 。 这里有很多不错的答案。 Refer - Multi-select DropDownlist in ASP.NET. You will many nice answers here.
更多推荐
如何将下拉列表转换为下拉列表
发布评论