Dropdown lists
-
I have a problem. I have two dropdown lists in my web page. named ddlApplication and ddlPermission and I have a button. I have two items in each dropdown list but when I choose second item and click on button and debug by using these lines of code it always gives me value of first item. How should I fix this problem. string str2 = this.ddlApplication.SelectedItem.Text; string str3 = this.ddlPermission.SelectedItem.Text; hahii
-
I have a problem. I have two dropdown lists in my web page. named ddlApplication and ddlPermission and I have a button. I have two items in each dropdown list but when I choose second item and click on button and debug by using these lines of code it always gives me value of first item. How should I fix this problem. string str2 = this.ddlApplication.SelectedItem.Text; string str3 = this.ddlPermission.SelectedItem.Text; hahii
This is solution for you Check it on your system protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.SelectedIndex = 0; DropDownList2.SelectedIndex = 0; } } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Response.Write(DropDownList1.SelectedValue); Response.Write(DropDownList2.SelectedValue); }
Sujit