我在行更新时找不到下拉列表: DropDown列表位于 EditTemplate
中protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
SqlDataSource2.UpdateParameters.Clear();
string op = "1";
try
{
DropDownList ddl = GridView1.FindControl("ddlprioridade") as DropDownList;
op = ddl.SelectedValue.ToString();
}
catch { }
....
}
这个ddl总是 null ,我无法解决这个问题!
答案 0 :(得分:2)
你试过这个:
var dropDown = GridView1.Rows[GridView1.EditIndex].FindControl("ddlprioridade") as DropDownList;