Dropdownlist not being populated with a query string paramter.

Question 1: 

I have two web pages, Page1.aspx, and Page2.aspx.
From Page1.aspx I'm passing a querystring "Page2.aspx State={0}" with
the State selected in page 1.

On page 2, the State is being received as I display it in a label. On Page2.aspx I also have a dropdownList with a sql "SELECT ...
WHERE @State=State" associated with control.

I want to be able to show items in the dropdownlist as soon as I enter
Page2. I have tried binding in code using ExecuteReader, but no luck.

This might be a very basic question, but I don't know whats happening.

Any suggestions





Answer this question

Dropdownlist not being populated with a query string paramter.

  • Cuzzlor

    Try checking the generated SQL statement after you have populated it with the state value. You can use a Console.WriteLine and see the Output window to find out what Select statement is being generated. Perhaps the State is not being given correctly in the SQL statement. So do a check on it and see.

    -Mamta


  • wwfDev

    Thanks for replying. I fixed the problem by init a hidden Textbox with the QueryString, and that worked fine.

  • Vitalie Ciobanu

    Hi

    use quick watch window for testing the query.

    In page2, u have to write it in load event.


  • Dropdownlist not being populated with a query string paramter.