I have placed two dropdownlist in my web one is bound and one is unbound. When i select the last index which has the same value as the 0 index it jumps to 0 index automatically and did not show the value of last index. It is happening only with bound dropdownlist while manually add dropdownlist is working fine with all indexes with same value.
Datalist2 is manually added and working fine with all indexs and values.
public void Binddata()
{
string queryy = "select * from menus where restid='" + Session["Restid"].ToString() + "' and typee = '" + Session["mpage"].ToString() + "'";
cmddd = new SqlCommand(quer yy, conn);
SqlDataAdapter adp = new SqlDataAdapter( cmddd);
DataSet ds = new DataSet();
adp.Fill(ds);
conn.Open();
cmddd.ExecuteNo nQuery();
DropDownList1.D ataSource = ds;
DropDownList1.D ataTextField = "menu";
DropDownList1.D ataValueField = "psizes";
DropDownList1.D ataBind();
conn.Close();
}
protected void Button1_Click(o bject sender, EventArgs e)
{
lblMsg.Text = DropDownList2.S electedItem.Tex t + DropDownList1.S electedItem.Tex t;
}
Any one faced this issue before.
Datalist2 is manually added and working fine with all indexs and values.
public void Binddata()
{
string queryy = "select * from menus where restid='" + Session["Restid"].ToString() + "' and typee = '" + Session["mpage"].ToString() + "'";
cmddd = new SqlCommand(quer yy, conn);
SqlDataAdapter adp = new SqlDataAdapter( cmddd);
DataSet ds = new DataSet();
adp.Fill(ds);
conn.Open();
cmddd.ExecuteNo nQuery();
DropDownList1.D ataSource = ds;
DropDownList1.D ataTextField = "menu";
DropDownList1.D ataValueField = "psizes";
DropDownList1.D ataBind();
conn.Close();
}
protected void Button1_Click(o bject sender, EventArgs e)
{
lblMsg.Text = DropDownList2.S electedItem.Tex t + DropDownList1.S electedItem.Tex t;
}
Any one faced this issue before.