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

 <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回显、筛选回显

上一篇:微信小程序使用全局变量


下一篇:js获取中国省市区,省市筛选、省市、省市筛选联动。【C#】【js】