vs2005 中 GirdView 中嵌入DropDownList 赋值 报错
protected void ProjectView_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList ddl = (DropDownList)e.Row.FindControl("ddlowner");
ddl.DataSource = OwenList();
ddl.DataTextField = "UserName";
ddl.DataValueField = "UserID";
ddl.DataBind();
}
这是代码赋值
报错 Object reference not set to an instance of an object.
OwenList();返回的是一个DataTable 这是对的
执行之后发现是ddl 是Null 但是(DropDownList)e.Row.FindControl("ddlowner");这句ID是对的
请问有什么问题啊??