我有三个dropdownlists
,autopostaback=true
但问题是第二个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();
}