【问题标题】:UpdatePanel trigger: Could not find an event named 'OnRowCommand'UpdatePanel 触发器:找不到名为“OnRowCommand”的事件
【发布时间】:2013-11-04 21:05:43
【问题描述】:

我希望GridViewOnRowCommand 事件不对ErrorLinkButton 点击执行完整的回发。因此,我将控件包装在更新面板中,并为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>

但我收到以下错误:

在关联控件上找不到名为“OnRowCommand”的事件 UpdatePanel 中触发器的“DataSourceMappingGridView” '错误更新面板'。

【问题讨论】:

    标签: c# asp.net .net updatepanel


    【解决方案1】:

    事件被称为RowCommand 而不是OnRowCommand

    替换

    EventName="OnRowCommand"
    

    EventName="RowCommand"
    

    它应该可以工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-21
      • 2011-10-03
      • 2011-12-26
      • 1970-01-01
      • 2011-01-16
      • 2013-08-20
      • 1970-01-01
      相关资源
      最近更新 更多