私は3つdropdownlists
持ってautopostaback=true
いますが、問題は2番目dropdownlist
だけpageload
が呼び出されますが、selectedindexchanged
起動していません!私は何ができますか?(dropdownlists
にありますupdatepanel
)
EDIT:
protected void Page_Load(object sender, EventArgs e)
{
if (DDL_d1.Items.Count == 0)
{
SqlDataReader dr = null;
DbAccessor db = new DbAccessor();
dr = db.SqlSelectS("true", "SELECT Fname FROM [Tbl_Amoozesh]");
DDL_d1.Items.Clear();
while (dr.Read())
DDL_d1.Items.Add(dr[0].ToString());
db.Dispose();
}
}
protected void d1(object sender, EventArgs e)
{
DDL_d1.AutoPostBack = false;
SqlDataReader dr = null;
DbAccessor db = new DbAccessor();
dr = db.SqlSelectS(DDL_d1.SelectedValue,"SELECT Fname FROM [Tbl_Amoozesh] where Fname = @a");
DDL_d2.Items.Clear();
DDL_d2.Items.Add(new ListItem("hi"));
while (dr.Read())
DDL_d2.Items.Add(dr[0].ToString());
db.Dispose();
}
protected void d2(object sender, EventArgs e)
{
SqlDataReader dr = null;
DbAccessor db = new DbAccessor();
dr = db.SqlSelectS(DDL_d2.SelectedValue, "SELECT Lname FROM [Tbl_Amoozesh] where Fname = @a");
DDL_d3.Items.Clear();
while (dr.Read())
DDL_d3.Items.Add(dr[0].ToString());
db.Dispose();
}