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. Problem in Retrieving value from Dropdown List.

Problem in Retrieving value from Dropdown List.

Scheduled Pinned Locked Moved ASP.NET
wpfwcfsaleshelp
6 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.
  • B Offline
    B Offline
    Binod K
    wrote on last edited by
    #1

    Hi, I am populating DropDownList using Data Source, and assigning Value and binding it using following code. ddlCustomer.DataSource = dsSeedData.Tables["Cust"]; ddlCustomer.DataTextField = dsSeedData.Tables["Cust"].Columns["CustomerName"].ColumnName.ToString(); ddlCustomer.DataValueField = dsSeedData.Tables["Cust"].Columns["Customer_ID"].ColumnName.ToString(); ddlCustomer.DataBind(); When i fetch value, it fetch first value from Dropdown, after click on Save button. After postback it reset all the value. To fetch i m using following code. object[] param=new object[50]; param[0] = ddlCustomer.SelectedItem.Value; What should be approach to Solve this problem. Thanks.

    N W 2 Replies Last reply
    0
    • B Binod K

      Hi, I am populating DropDownList using Data Source, and assigning Value and binding it using following code. ddlCustomer.DataSource = dsSeedData.Tables["Cust"]; ddlCustomer.DataTextField = dsSeedData.Tables["Cust"].Columns["CustomerName"].ColumnName.ToString(); ddlCustomer.DataValueField = dsSeedData.Tables["Cust"].Columns["Customer_ID"].ColumnName.ToString(); ddlCustomer.DataBind(); When i fetch value, it fetch first value from Dropdown, after click on Save button. After postback it reset all the value. To fetch i m using following code. object[] param=new object[50]; param[0] = ddlCustomer.SelectedItem.Value; What should be approach to Solve this problem. Thanks.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Make sure you have viewstate turned on.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      B 1 Reply Last reply
      0
      • N N a v a n e e t h

        Make sure you have viewstate turned on.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        B Offline
        B Offline
        Binod K
        wrote on last edited by
        #3

        Yes, Navaneeth. ViewState Property is True ( EnableViewState="True").

        N 1 Reply Last reply
        0
        • B Binod K

          Hi, I am populating DropDownList using Data Source, and assigning Value and binding it using following code. ddlCustomer.DataSource = dsSeedData.Tables["Cust"]; ddlCustomer.DataTextField = dsSeedData.Tables["Cust"].Columns["CustomerName"].ColumnName.ToString(); ddlCustomer.DataValueField = dsSeedData.Tables["Cust"].Columns["Customer_ID"].ColumnName.ToString(); ddlCustomer.DataBind(); When i fetch value, it fetch first value from Dropdown, after click on Save button. After postback it reset all the value. To fetch i m using following code. object[] param=new object[50]; param[0] = ddlCustomer.SelectedItem.Value; What should be approach to Solve this problem. Thanks.

          W Offline
          W Offline
          www Developerof NET
          wrote on last edited by
          #4

          Write your dropdown filling code in if(!IsPostBack){...} in page load event....:cool:

          When you fail to plan, you are planning to fail.

          B 1 Reply Last reply
          0
          • W www Developerof NET

            Write your dropdown filling code in if(!IsPostBack){...} in page load event....:cool:

            When you fail to plan, you are planning to fail.

            B Offline
            B Offline
            Binod K
            wrote on last edited by
            #5

            Problem Solved. Thanks.

            1 Reply Last reply
            0
            • B Binod K

              Yes, Navaneeth. ViewState Property is True ( EnableViewState="True").

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              Try developer.net's suggestion. That might solve issue

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              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