下拉列表中的多选复选框 [英] Multiselect checkbox in dropdown

查看:104
本文介绍了下拉列表中的多选复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生/女士,

我想使用下拉菜单,我可以使用复选框选择多个值。任何人都可以请

给我一步一步的描述。



感谢和问候: -

Sumit Verma

Respected Sir/ Ma'am,
I want to use a dropdown where i can select multiple values using checkboxes. Can anyone please
give me the step by step description to do so.

Thanks & Regards:-
Sumit Verma

推荐答案

检查此

多选Web应用程序下拉列表 [ ^ ]


试试这个..我从db获取数据并将其绑定到复选框列表..



希望它能帮到你..



Try this..here am fetch the data from db and bind it to the checkbox list..

Hope it will help you..

<div id="divCheckBoxList" runat="server" style="height: 85px; width: 182px; border: solid 1px #D7DADF;">
                                <asp:panel id="pnlCheckBoxList" runat="server" style="font-family: Arial; font-weight: normal; font-size: small;" xmlns:asp="#unknown">
                                    <div id="divScroll" style="height: 85px; width: auto; overflow-y: scroll; overflow-x: hidden;">
                                        <asp:checkboxlist id="chkLBoxKList" runat="server">
                                            Width="100%" DataTextField=" " DataValueField=" " AutoPostBack="true">
                                        </asp:checkboxlist>
                                    </div>
                                </asp:panel>
                            </div>







try
            {
                s = WebConfigurationManager.ConnectionStrings["con"].ConnectionString;
                con = new SqlConnection(s);
                String str = "";
                for (int i = 0; i <= chkLBoxKList.Items.Count - 1; i++)
                {
                    if (chkLBoxKList.Items[i].Selected)
                    {
                        str = chkLBoxKList.Items[i].Text;
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }                        
                        cmd = new SqlCommand("sp_person_chkbox_list", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@empid", SqlDbType.Int).Value = id;
                        cmd.Parameters.Add("@DEPARTMENT", SqlDbType.VarChar).Value = str;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (SqlException ex)
            {
                Console.WriteLine("SQL Error" + ex.Message.ToString());
                //return 0;
            }


请参阅: MultiSelect下拉控件 [ ^ ]



问候..
See this : MultiSelect Dropdown Control[^]

Regards..


这篇关于下拉列表中的多选复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆