<div class="checkboxData">
<asp:CheckBoxList ID="cblStrength" Class="checkBoxFilter" runat="server" DataTextField="language" OnSelectedIndexChanged="cblStrength_SelectedIndexChanged"
DataValueField="language" RepeatLayout="OrderedList" Width="432px">
</asp:CheckBoxList>
</div>
以上代码适用于我的Checkboxlist。此Checkboxlist值是从数据库
动态绑定的DataSet dsFilterItems = new DataSet();
CheckBoxList cblStrength = (CheckBoxList)Master.FindControl("cblStrength");
CheckBoxList cblForm = (CheckBoxList)Master.FindControl("cblForm");
CheckBoxList cblSize = (CheckBoxList)Master.FindControl("cblSize");
dsFilterItems = itemsBL.GetItemsForFilter(null, null, strkeywords, null, null, custRole);
if (dsFilterItems.Tables.Count >= 0)
{
//cblStrength.Controls.Add(new LiteralControl("<br />"));
cblStrength.DataSource = dsFilterItems.Tables[0];
cblStrength.DataTextField = "Strength";
cblStrength.DataValueField = "Strength";
cblStrength.DataBind();
//cblForm.Controls.Add(new LiteralControl("<br />"));
cblForm.DataSource = dsFilterItems.Tables[1];
cblForm.DataTextField = "itemForm";
cblForm.DataValueField = "itemForm";
cblForm.DataBind();
//cblSize.Controls.Add(new LiteralControl("<br />"));
cblSize.DataSource = dsFilterItems.Tables[2];
cblSize.DataTextField = "CF_Size";
cblSize.DataValueField = "CF_Size";
cblSize.DataBind();
}
根据搜索动态加载复选框值...
现在我必须在数据网格中只显示复选框选中的值,我有从数据库中选择的查询,如下所示
SELECT * FROM Items WHERE Strength IN (@cblStrength)
但它仅适用于单个复选框值,我应该如何进行多重选择以及如何在不刷新的情况下加载数据网格。
答案 0 :(得分:0)
您必须连接sql查询才能使多个/逗号分隔参数起作用。例如
<FrameLayout>
快乐编码!!