html代码:
<ItemTemplate>
<asp:Literal ID="faculty" runat="server" Text='<%#Eval("facultyname")%>'>
</asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="fact" runat="server">
</asp:DropDownList>
代码后置:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
DropDownList dropdown = GridView1.Rows[e.NewEditIndex].FindControl("fact") as DropDownList;
facultyDal c = new facultyDal();
dropdown.DataSource = c.show();
dropdown.DataBind();
dropdown.DataTextField = "facultyname";
dropdown.DataValueField = "facultyid";
}
例外:
你调用的对象是空的。
当我使用数据源绑定到下拉列表时,会发生上述异常,请帮助....