2013-11-04 79 views
5

我希望GridViewOnRowCommand事件不能在ErrorLinkButton點擊上執行完整回發。所以我包裹在一個更新面板控制,並增加了AsyncPostBackTriggerOnRowCommandUpdatePanel觸發器:找不到名爲'OnRowCommand'的事件

<asp:GridView ID="DataSourceMappingGridView" runat="server" DataKeyNames="Index" ClientIDMode="Static" OnRowCommand="DataSourceMappingGridView_RowCommand" OnRowDataBound="DataSourceMappingGridView_RowDataBound"> 
<Columns> 
    <asp:TemplateField> 
     <ItemTemplate> 
      <asp:UpdatePanel ID="ErrorUpdatePanel" runat="server"> 
       <Triggers> 
        <asp:AsyncPostBackTrigger ControlID="DataSourceMappingGridView" EventName="OnRowCommand" /> 
       </Triggers> 
       <ContentTemplate> 
        <asp:LinkButton ID="ErrorTextLinkButton" CommandName="Errors" CommandArgument='<%#Bind("Index") %>' runat="server" Text='View Errors' /> 
       </ContentTemplate> 
      </asp:UpdatePanel> 
     </ItemTemplate> 
    </asp:TemplateField> 
</Columns> 
</asp:GridView> 

,但我得到了以下錯誤:

Could not find an event named 'OnRowCommand' on associated control 'DataSourceMappingGridView' for the trigger in UpdatePanel 'ErrorUpdatePanel'.

回答

11

該事件被稱爲RowCommandOnRowCommand

更換

EventName="OnRowCommand" 

EventName="RowCommand" 

,它應該工作

相關問題