none
Binding Dropdownlist selected item in Textbox RRS feed

  • Question

  • Hi ,

    i Have one test box..in page1.aspx
    i have one dropdownlist in page2.aspx

    My requirement is...whenever i am selecting one value in dropdownlist ...the selected value should display in textbox.
    • Moved by Jason Dot Wang Tuesday, March 19, 2013 6:31 AM This thread is about ASP.NET
    Saturday, March 16, 2013 8:13 AM

All replies

  • A simple way:

    1) Make Dropdownlist's AutoPostBack=True

    2) Handle the event of Dropdownlist's SelectIndexChanged, and then write:

    Response.Write(B.aspx?value="+Dropdownlist.SelectedValue.ToString());

    3) In B.aspx, plz use Request.QueryString to accept the value


    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats

    Saturday, March 16, 2013 8:21 AM
  •  

    In Page2.aspx.cs...under selected changed event..i have written below code.

    Response.Write("ProjectName?SelectedValue=" + wddlProjectName.SelectedValue);

    In page1.aspx.cs...under pageload event i have written below code

     string v = Request.QueryString["SelectedValue"];
            wtxtPrj.Text = v;

    But its not working?

    Saturday, March 16, 2013 9:05 AM
  • Make sure that your Dropdownlist's AutoPostBack=True
    And make sure that your DisplayTextField and DisplayValueField are both set.

    Debug ur SelectedValue——See whether it has value or not?


    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats

    Saturday, March 16, 2013 9:09 AM
  • Inside an event
    if (IsPostBack)
    {
    yourAspTextboxOnThePage = Dropdownlist.SelectedValue.ToString());
    }
    Be aware even if this is async this means a roundtrip to the server.

    Success
    Cor

    Saturday, March 16, 2013 11:56 AM
  • Hi Kommanaboyina,

      Welcome to MSDN Forum Support.

     

      You'll need to post it in the dedicated ASP.Net Forum http://forums.asp.net for more efficient responses, where you can contact ASP.NET experts.

      Sincerely,

      Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, March 19, 2013 6:30 AM