Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Cross Page Posting for DropDownList

Cross Page Posting for DropDownList

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muhammad Chitrali
    wrote on last edited by
    #1

    Hi: Can any one please tell me how can i get the value of a dropdownlist of the previous page. The code below doesn't work. if (Page.PreviousPage != null) { DropDownList ddlLF = (DropDownList)Page.PreviousPage.FindControl("ddlLeavingFrom"); DropDownList ddlGT = (DropDownList)Page.PreviousPage.FindControl("ddlGoingTo"); if (ddlLF != null) txtLF.Text = ddlLF.SelectedItem.ToString(); if (ddlGT != null) txtGT.Text = ddlGT.SelectedItem.ToString(); } Waiting..... for answer

    M M 2 Replies Last reply
    0
    • M Muhammad Chitrali

      Hi: Can any one please tell me how can i get the value of a dropdownlist of the previous page. The code below doesn't work. if (Page.PreviousPage != null) { DropDownList ddlLF = (DropDownList)Page.PreviousPage.FindControl("ddlLeavingFrom"); DropDownList ddlGT = (DropDownList)Page.PreviousPage.FindControl("ddlGoingTo"); if (ddlLF != null) txtLF.Text = ddlLF.SelectedItem.ToString(); if (ddlGT != null) txtGT.Text = ddlGT.SelectedItem.ToString(); } Waiting..... for answer

      M Offline
      M Offline
      mnaveed
      wrote on last edited by
      #2

      wot i understand by your question according to that you can use different methods to pass data between pages like Session variable Query string using cach..etc depends upon your requirment. simplest is session i think. //adding in session Session.Add("DDValue", DropDownList.SelectedItem); //taking value from session on another page or on same page string DropDownValue = Session["DDValue"].ToString(); Sorry if its not the solution you looking 4. Nav.

      M 1 Reply Last reply
      0
      • M mnaveed

        wot i understand by your question according to that you can use different methods to pass data between pages like Session variable Query string using cach..etc depends upon your requirment. simplest is session i think. //adding in session Session.Add("DDValue", DropDownList.SelectedItem); //taking value from session on another page or on same page string DropDownValue = Session["DDValue"].ToString(); Sorry if its not the solution you looking 4. Nav.

        M Offline
        M Offline
        Muhammad Chitrali
        wrote on last edited by
        #3

        Thanks for your suggession but unfortunately when i retrive the values of Session Variables it returns null.

        1 Reply Last reply
        0
        • M Muhammad Chitrali

          Hi: Can any one please tell me how can i get the value of a dropdownlist of the previous page. The code below doesn't work. if (Page.PreviousPage != null) { DropDownList ddlLF = (DropDownList)Page.PreviousPage.FindControl("ddlLeavingFrom"); DropDownList ddlGT = (DropDownList)Page.PreviousPage.FindControl("ddlGoingTo"); if (ddlLF != null) txtLF.Text = ddlLF.SelectedItem.ToString(); if (ddlGT != null) txtGT.Text = ddlGT.SelectedItem.ToString(); } Waiting..... for answer

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          What do you mean by "doesn't work"? You cannot get reference to the dropdownlist or the selected item returns empty? If you cannot get reference to teh dropdownlist then you might want to double check where you place the dropdownlist control in the source page. If it is placed inside another naming container, you will need to access the container before you want to access the dropdownlist. Cross-Page Posting in ASP.NET Web Pages [^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups