Populating dropdownlists through LINQ based on a selection from another dropdownlist

moto11

New Member
I have been working on this and it works. However after attempting to change my option from the controlling dropdownlist to see another list in the dropdown that should show my dynamic list, nothing happens. It still shows the previous list. Could i get some help with this?:Here is my Front side: \[code\] <label for="ddlGift1">Gift #1</label> <asp:DropDownList runat="server" ID="ddlGift1" class="gift" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" OnSelectedIndexChanged="ddlGift1_SelectedIndexChanged"> <asp:ListItem Value="http://stackoverflow.com/questions/15642284/--" Text="Please Select" /> </asp:DropDownList> <label for="ddlFName1">Fund Name</label> <asp:DropDownList runat="server" ID="ddlFName1" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" > <asp:ListItem Value="http://stackoverflow.com/questions/15642284/--" Text="Please Select" /> </asp:DropDownList> <label for="ddlGift2">Gift #2</label> <asp:DropDownList runat="server" ID="ddlGift2" class="gift" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" OnSelectedIndexChanged="ddlGift2_SelectedIndexChanged" > <asp:ListItem Value="http://stackoverflow.com/questions/15642284/--" Text="Please Select" /> </asp:DropDownList> <label for="ddlFName2">Fund Name</label> <asp:DropDownList runat="server" ID="ddlFName2" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" > <label for="txtPAmount2">Pledge Amount</label> <asp:TextBox runat="server" ID="txtPAmount2" CssClass="narrow" text="0.00" onClick="ComputeCosts();" ClientIDMode="Static" class="PAmount" /> <label for="ddlGift3">Gift #3</label> <asp:DropDownList runat="server" ID="ddlGift3" class="gift" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" OnSelectedIndexChanged="ddlGift3_SelectedIndexChanged"> <asp:ListItem Value="http://stackoverflow.com/questions/15642284/--" Text="Please Select" /> </asp:DropDownList> <label for="ddlFName3">Fund Name</label> <asp:DropDownList runat="server" ID="ddlFName3" AutoPostBack="true" AppendDataBoundItems="True" ClientIDMode="Static" > <asp:ListItem Value="http://stackoverflow.com/questions/15642284/--" Text="Please Select" /> </asp:DropDownList>\[/code\]Backside:Example of one function:\[code\]private void SetCOB(DropDownList name) { var _db = (from a in _foundation.COB orderby a.id select new { a.id, a.name }); name.DataSource = _db; name.DataTextField = "name"; name.DataValueField = "id"; name.DataBind(); } protected void ddlGift1_SelectedIndexChanged(object sender, EventArgs e) { if(ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="41") { SetCOB(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="42") { SetCOLA(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="43") { SetCONHP(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="44") { SetOE(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="45") { SetCSEE(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="52") { SetA(ddlFName1); } else if (ddlGift1.SelectedValue =http://stackoverflow.com/questions/15642284/="54") { SetS(ddlFName1); } } protected void ddlGift2_SelectedIndexChanged(object sender, EventArgs e) { if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="41") { SetCOB(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="42") { SetCOLA(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="43") { SetCONHP(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="44") { SetOE(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="45") { SetCSEE(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="52") { SetA(ddlFName2); } else if (ddlGift2.SelectedValue =http://stackoverflow.com/questions/15642284/="54") { SetS(ddlFName2); } } protected void ddlGift3_SelectedIndexChanged(object sender, EventArgs e) { if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="41") { SetCOB(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="42") { SetCOLA(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="43") { SetCONHP(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="44") { SetOE(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="45") { SetCSEE(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="52") { SetA(ddlFName3); } else if (ddlGift3.SelectedValue =http://stackoverflow.com/questions/15642284/="54") { SetS(ddlFName3); } }\[/code\]
 
Back
Top