On Postback, are they tied to events? If yes, then put them
in the
event handlers. If not, call the correct method from the
page_load
method. Even if they are handled by events, you should
still call a
different method from the event handlers since it seems you
are wanting
the same calls multiple times.
I hope this make sense.
Joe B.
-----Original Message-----
From: Robert Dickson [mailto:robertgdickson gmail.com]
Sent: Monday, June 26, 2006 6:43 PM
To: aspnet aspadvice.com
Subject: [aspnet] Chained DropDownLists and adding items.
Hi folks,
I have a webform with a series of DropDownLists, the first
of which
controls
the content for the 2nd and 3rd. The trouble is I need to be
able after
the
postback call which binds those controls add about 4 items
manually to
the
2nd and 3rd DDL.
---Begin Code Snippet---
<asp ropDownL
ist ID="ddlDivList" runat="server"
DataSourceID="sqlDDLDiv"
DataTextField="DivName"
DataValueField="DivID"
AutoPostBack="true"></asp ropDownL
ist>
<asp ropDownL
ist ID="ddlHome" runat="server"
DataSourceID="sqlDDLHome"
DataTextField="TeamName"
DataValueField="TeamName"></asp ropDownL
ist>
<asp ropDownL
ist ID="ddlVisitor" runat="server"
DataSourceID="sqlDDLVisitor"
DataTextField="TeamName"
DataValueField="TeamName"></asp ropDownL
ist>
<asp:SqlDataSource ID="sqlDDLDiv"
runat="server"
ConnectionString="<%$ ConnectionStrings:local
%>"
SelectCommand="SELECT [DivName], [DivID] FROM
[AdultDiv]"></asp:SqlDataSource>
<asp:SqlDataSource ID="sqlDDLVisitor"
runat="server"
ConnectionString="<%$ ConnectionStrings:local
%>"
SelectCommand="SELECT [TeamName] FROM
[AdultTeamStandings] WHERE
([DivID] = DivID)">
<SelectParameters>
<asp:ControlParameter
ControlID="ddlDivList" Name="DivID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sqlDDLHome"
runat="server"
ConnectionString="<%$ ConnectionStrings:local
%>"
SelectCommand="SELECT [TeamName] FROM
[AdultTeamStandings] WHERE
([DivID] = DivID)">
<SelectParameters>
<asp:ControlParameter
ControlID="ddlDivList" Name="DivID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
---End Code Snippet---
Any suggestions how I can programatically add 4 items
manually to the
Home/Visitor DDL controls?
--
Thanks,
Robert
--- List Sponsor ---
ASP & ASP.NET Web Hosting with 3 Months FREE & FREE
Setup!
ASP/.NET Hosting from a Microsoft Gold Partner supporting
ASP.NET
2.0/1.1, ASP, MS SQL 2005/2000 with DBO Access, Free
ASP/.NET Components
& more.
Click Here for More Information: http://www.disc
ountasp.net/aspadvice/
--- List Sponsor ---
ASP & ASP.NET Web Hosting with 3 Months FREE & FREE
Setup!
ASP/.NET Hosting from a Microsoft Gold Partner supporting
ASP.NET 2.0/1.1, ASP, MS SQL 2005/2000 with DBO Access, Free
ASP/.NET Components & more.
Click Here for More Information: http://www.disc
ountasp.net/aspadvice/
|