Problem in Retrieving value from Dropdown List.
-
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.
-
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.
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
-
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
-
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.
Write your dropdown filling code in if(!IsPostBack){...} in page load event....:cool:
When you fail to plan, you are planning to fail.
-
Write your dropdown filling code in if(!IsPostBack){...} in page load event....:cool:
When you fail to plan, you are planning to fail.
-
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