Hi,
If I have a SQL DataSource as the data source for a DroDownList [as below], and within this page I have called a record from the DB that relates to this drop down list [but only one value] how do I ensure that /that/ value is selected?
##################### CODE #####################
<asp:DropDownList ID="ddlTowns"
runat="server"
DataSourceID="dataTowns"
DataTextField="GT_Name"
DataValueField="GT_ID">
</asp:DropDownList>
<asp:SqlDataSource ID="dataTowns"
runat="server"
ConnectionString="<%$ ConnectionStrings:dbConn %>"
SelectCommand="townsSelect"
SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
##################### END OF CODE #####################
I'm guessing I have to write some code in the aspx.cs file such as
##################### ASPX.CS #####################
protected void Page_Load(object sender, EventArgs e)
{
this.ddlTowns.SelectedIndex = ...
}
##################### END OF ASPX.CS #####################
Any help greatly appreciated..
Can anyone point me in the direction of a great resource for this sort of thing?
Cheers..
Hasta Luego..
KingRoon
DogFightClothing. No dogs. No fighting.
http://www.dogfightclothing.com