Reputation: 13
I implemented a drop down in my ASP.net page .I put data sourse and bind drop down in page load event . I get the data in the drop down without any problem . But when i selected a value it always send index 1 value . I tried different values but it always sends the index 1 value to the backend
string[] parity = conData.GetParity();
ddlParity.DataSource = parity.ToList();
ddlParity.DataBind();
modemDetailsObj.Parity = ddlParity.SelectedValue;
Upvotes: 0
Views: 234
Reputation: 148110
You are probably binding the dropdown in postback again. You need to bind it in !Postback
if(!Page.IsPostBack)
{
string[] parity = conData.GetParity();
ddlParity.DataSource = parity.ToList();
ddlParity.DataBind();
}
Upvotes: 3