首页 > Windows开发 > 详细

C# CheckBoxList-DropDownList回显、筛选回显

时间:2021-09-06 22:58:25      阅读:22      评论:0      收藏:0      [点我收藏+]
 <asp:CheckBoxList ID="ddlType" runat="server" RepeatColumns="10" RepeatDirection="Horizontal"></asp:CheckBoxList>
 
 string ctypes = Convert.ToString(dtPtsDetail.Rows[0]["Type1"]);

                string[] arr = ctypes.Split(‘,‘);
                for (int c = 0; c < arr.Length - 1; c++)
                {
                        ddlType.Items.Add(arr[c]);
                   
                }
                
                foreach (string ar in arr)
                {
                    foreach (ListItem itc in ddlType.Items)
                    {
                        if (ar == itc.Value)
                            itc.Selected = true;
                        else
                            continue;
                    }
                   
                }

<asp:DropDownList ID="ddlType" runat="server"  AutoPostBack="true" ></asp:DropDownList>
				
 string ctypes = Convert.ToString(dtPtsDetail.Rows[0]["Type1"]);

                string[] arr = ctypes.Split(‘,‘);
               
                         ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(arr[0]));
                   
                
				

  

C# CheckBoxList-DropDownList回显、筛选回显

原文:https://www.cnblogs.com/liuguiqing/p/15232773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!