DropDownList not working after using .SelectedValue

Total Post:128

Points:898
 1082  View(s)
Ratings:
Rate this:
I'm new with asp.net and i think this is really easy question, but i can't find the answer
I have a DropDownList on my page, one of the ways to go to that page is follow the link on the other page (page B). By this link i deliver some parameters, so i use them in the Page_load of page A:

    protected void Page_Load(object sender, EventArgs e)
    {
        string strStatus = Request.QueryString["status"];
        DListStatus.SelectedValue = strStatus;
    }

I thought that .ClearSelection() will help

i really wonder what to do and will really appreciate your help

  1. Post:378

    Points:2694
    Re: DropDownList not working after using .SelectedValue

    Hi Ashish, 


    Check if is it is a post back

    if (!Page.IsPostBack)
    {
        string strStatus = Request.QueryString["status"];
        DListStatus.SelectedValue = strStatus;
    }

      Modified On Apr-06-2018 06:38:56 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!