i using sql datasource , checkboxlist filter datalistview. want make parameter sqldatasource code behind , use sql in filter datalistview rows. when check 1 checkbox in checkboxlist work great... when check more 1 checkbox datalist view takes no data. onselecting code sql datasource:
protected void ds_subgroupid_changed_selecting(object sender,sqldatasourceselectingeventargs e) { list<string> selected = new list<string>(); foreach (listitem item in checkboxlist_subgroup.items) if (item.selected) { selected.add(item.value); } string commaselect = string.join(",", selected.toarray()); e.command.parameters["@product_subgroup"].value = commaselect; }
and here sqldatasource control:
<asp:sqldatasource id="ds_subgroupid_changed" runat="server" connectionstring="<%$ connectionstrings:nimrokhdbconnectionstring %>" selectcommand="select * [tbl_product] (([product_group] = @product_group) , ([product_subgroup] in (@product_subgroup)))" onselecting="ds_subgroupid_changed_selecting"> <selectparameters> <asp:controlparameter controlid="radio_list_group" name="product_group" propertyname="selectedvalue" type="string" /> <asp:parameter name="product_subgroup" /> </selectparameters> </asp:sqldatasource>
i have 1 table subgroup contains subgroupid int , subgroupname, , have table product contan subgroup store subgroup id in nvarchar. wonder if cause problem. because checkboxlist value set subgroupid form subgroup table.
i appretiate help. thank guys.
Comments
Post a Comment