asp.net - DropdownList Selected Value as Parameter for another DropdownList -
i'm having bit of difficulty trying accomplish goal here,
i have 2 dropdowns, i'd able change values available within dropdown_objective according selected value within dropdown_parent. these dropdowns contained within templatefield,
<asp:gridview id="gridview1" runat="server" allowpaging="true" allowsorting="true" pagesize="20" autogeneratecolumns="false" datakeynames="visitobjectivekey" onsorting="gridview1_sorting" onpageindexchanging="gridview1_pageindexchanging" width="100%"> <columns> <asp:templatefield headertext="parentid" sortexpression="parentid"> <edititemtemplate> <asp:dropdownlist id="updparentid" runat="server" width="100%" skinid="-1" cssclass="text ui-widget-content ui-corner-all" appenddatabounditems="true" datasource="sqldatasource1" datatextfield="parentkeydesc" datavaluefield="parentkey" > </asp:dropdownlist> </edititemtemplate> <itemtemplate> <asp:label id="itemparentid" runat="server" text='<%# eval("parentid") %>' ></asp:label> </itemtemplate> <footertemplate> <asp:dropdownlist id="insparentid" runat="server" width="100%" skinid="-1" cssclass="text ui-widget-content ui-corner-all" appenddatabounditems="true" datasource="sqldatasource1" datatextfield="parentkeydesc" datavaluefield="parentkey" > </asp:dropdownlist> </footertemplate> </asp:templatefield> <asp:templatefield headertext="objective" sortexpression="objective"> <edititemtemplate> <asp:dropdownlist id="updobjective" runat="server" width="100%" skinid="-1" cssclass="text ui-widget-content ui-corner-all" appenddatabounditems="true" datasource="sqldatasource2" datatextfield="objectivekeydesc" datavaluefield="objectivekey" > </asp:dropdownlist> </edititemtemplate> <itemtemplate> <asp:label id="itemobjective" runat="server" text='<%# eval("objective") %>' ></asp:label> </itemtemplate> <footertemplate> <asp:dropdownlist id="insobjective" runat="server" width="100%" skinid="-1" cssclass="text ui-widget-content ui-corner-all" appenddatabounditems="true" datasource="sqldatasource2" datatextfield="objectivekeydesc" datavaluefield="objectivekey" > </asp:dropdownlist> </footertemplate> </asp:templatefield> </columns>
this sqldatesource i'm trying use dropdown_objective,
<asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" selectcommand="select objectivekey, objectivekeydesc t_table objectivekey = @parentid"> <selectparameters> <asp:controlparameter controlid="updparentid" name="parentid" propertyname="selectedvalue" type="string" /> </selectparameters> </asp:sqldatasource>
any ideas i'm doing wrong or how can achieve goal?
where clause should specified in query inside of selectcommand
attribute in asp:sqldatasource
: selectcommand="select objectivekey, objectivekeydesc t_table objectivekey = @parentid">
try instead: selectcommand="select objectivekey, objectivekeydesc t_table objectivekey = @parentid
Comments
Post a Comment