从下拉列表中选择多个值

从下拉列表中选择多个值

本文介绍了如何在文本框中插入基于逗号的值,从下拉列表中选择多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用asp gridview并使用复选框从下拉列表中选择多个值我希望将标签字段中的值用逗号分隔...



我尝试了什么:



Hi
I am working on asp gridview and on selecting multiple values from dropdown list using checkboxes I want to get the values in label field separated by comma ...

What I have tried:

protected void dd2_selectedindexchanged(object sender, EventArgs e)
       {
           DropDownList DropDownList1 = sender as DropDownList;
           foreach (GridViewRow row in gvDetails.Rows)
           {
               Control ctrl = row.FindControl("DropDownList2") as DropDownList;
               Control ctr = row.FindControl("Label4") as Label;
               Label Label2 = row.FindControl("Label4") as Label;
               Label2.Text += DropDownList1.SelectedValue + ", ";




           }
       }

推荐答案

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
        rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css" />
    <script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js" type="text/javascript"></script>
    <script type="text/javascript">




这篇关于如何在文本框中插入基于逗号的值,从下拉列表中选择多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 09:02