asp:SqlDataSource binded to asp:DropDownList
Posted
by _simon_
on Stack Overflow
See other posts from Stack Overflow
or by _simon_
Published on 2009-07-23T13:09:51Z
Indexed on
2010/04/21
22:43 UTC
Read the original article
Hit count: 262
c#
|sqldatasource
I have a asp:SqlDataSource and asp:DropDownList components on my page. On normal page it works ok.
Now I'd like to put this on new page with url like ...mypage.aspx?transactionID=2. In Page_Load I would like to set Transaction drop down selected index to 2. But it always binds to 1. I assume, that things happen in this order: in Page_Load I set selected index to 2. Then asp:SqlDataSource's select statement executes and binds to DropDownList. That's why selected index of my DropDownList is always 1, no matter what I set it in Page_Load.
So, how can I bind asp:SqlDataSource to asp:DropDownList and also set it's selected index parameter to some integer?
© Stack Overflow or respective owner