2016-12-13 71 views
0

有人可以向我解释为什么我的EmployeeSearchResultsList_DataBindingComplete没有发射?这是我的理解,RowDataBound完成绑定数据后,它会自动启动DataBindingCompleteASP.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 
} 
+0

你真的在DGV上调用'bind()'吗? – TheValyreanGroup

+0

我是。被忽略发布。它在此之前发生。基本上得到一个员工名单,并绑定到gridview。 –

回答

1

GridView中没有一个DataBindingComplete事件。只有Webform的DataGridView控件有这个功能。

从你的问题,目前还不清楚你想要处理的事件。也许我们可以提供替代方案。

+0

因此,ASP.NET Forms中无法检测DataBind()何时完成? –

+1

不是我所知道的。查看所有事件[这里](https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview_events(v = vs.110).aspx) – VDWWD

+0

基本上,我需要设置一个GridIndex中定义的项目的tabIndex。当数据绑定完成时,我的想法就是抓住这一点。 –