如何将下拉列表转换为下拉列表

编程入门 行业动态 更新时间:2024-10-26 20:35:24
本文介绍了如何将下拉列表转换为下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要将下拉列表转换为下拉列表,所以基本上列表中的项目仍然相同,但应该有复选框。先谢谢。 以下是它的样子: 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.

更多推荐

如何将下拉列表转换为下拉列表

本文发布于:2023-08-05 17:06:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1306847.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:列表   转换为   如何将

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!