Hi,
I'm doing a response direct from page 1 with values from page 1 transmitted in url. How to get these values preselected in user controls (drop-down lists) in page 2?
Values in page 2 user controls are populated when page 2 loads (within if (!Page.IsPostBack) {...}) and I want transmitted values in url from page 1 to be preselected in user controls (drop-down lists) in page 2.
Thx in advance!
Loading
Suthish NairPosted Jan 30, 2011, 1:17 PM
So other members can easily find the answers.
Suthish NairPosted Jan 30, 2011, 1:40 PM
jesbonPosted Jan 30, 2011, 1:30 PM
jesbonPosted Jan 26, 2011, 5:54 AM
many thx, your suggestion works fine but gave me a new problem to solve.
Loading values and having wanted values preselectec works fine but the problem is that in one of the drop-downs (last one) all values (including preselected value) is showed for a second/while and then all values are removed from the drop-down, how come and how to solve this? The drop-down has a 'SelectedIndexChanged' and 'AutoPostBack' is set to true. 'SelectedIndexChanged'/'AutoPostBack' is loading an ajax panel with some information generated from the information in drop-downs which also is showed for a second/while and then dissapears.
Krishna GaradPosted Jan 26, 2011, 4:14 AM
Response.Redirect("Page2.aspx?val="+DropdownList1.SelectedValue.ToString());
In Page2.aspx.cs write following code
Page_Load()
{
if(!IsPostBack)
{
DropDownList1.SelectedValue=Request.QueryString["val"].ToString();
}
}