有人可以向我解释为什么我的EmployeeSearchResultsList_DataBindingComplete
没有发射?这是我的理解,RowDataBound
完成绑定数据后,它会自动启动DataBindingComplete
。ASP.NET窗体 - DataBindingComplete没有发射
的GridView:
<asp:GridView ID="employeeSearchResultsList" runat="server" CssClass="GridView" AutoGenerateColumns="false" ShowHeaderWhenEmpty="true" OnSelectedIndexChanged="EmployeeSearchResultsList_SelectedIndexChanged" OnRowDataBound="EmployeeSearchResultsList_RowDataBound" OnDataBindingComplete="EmployeeSearchResultsList_DataBindingComplete">
<Columns>
<asp:ButtonField HeaderText="Select" CommandName="select" Text="Select" ItemStyle-Width="50px" />
<asp:BoundField HeaderText="ID" DataField="ID" ItemStyle-Width="50px" />
<asp:BoundField HeaderText="Last Name" DataField="lastName" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="First Name" DataField="firstName" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="Middle Name" DataField="middleName" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="Status" DataField="status" ItemStyle-Width="100px" />
</Columns>
</asp:GridView>
的RowDataBound:
protected void EmployeeSearchResultsList_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Magic
}
DataBindingComplete:
protected void EmployeeSearchResultsList_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
// It does not hit here
}
你真的在DGV上调用'bind()'吗? – TheValyreanGroup
我是。被忽略发布。它在此之前发生。基本上得到一个员工名单,并绑定到gridview。 –