简体   繁体   English

UpdatePanel触发器:找不到名为“OnRowCommand”的事件

[英]UpdatePanel trigger: Could not find an event named 'OnRowCommand'

I want the OnRowCommand event of the GridView to not perform a full postback on a ErrorLinkButton click. 我希望GridViewOnRowCommand事件不在ErrorLinkButton点击上执行完整的回ErrorLinkButton So I wrapped the control in an update panel and added an AsyncPostBackTrigger for OnRowCommand : 所以我将控件包装在更新面板中,并为OnRowCommand添加了AsyncPostBackTrigger

<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>

But I get the following error: 但是我收到以下错误:

Could not find an event named 'OnRowCommand' on associated control 'DataSourceMappingGridView' for the trigger in UpdatePanel 'ErrorUpdatePanel'. 无法在关联控件'DataSourceMappingGridView'上找到名为'OnRowCommand'的事件,用于UpdatePanel'ErrorUpdatePanel'中的触发器。

The event is called RowCommand not OnRowCommand 该事件称为RowCommand而不是OnRowCommand

Replace 更换

EventName="OnRowCommand"

with

EventName="RowCommand"

and it should work 它应该工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM