Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. So I wrapped the control in an update panel and added an AsyncPostBackTrigger for 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>

But I get the following error:

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

like image 401
Dave New Avatar asked Nov 04 '13 12:11

Dave New


1 Answers

The event is called RowCommand not OnRowCommand

Replace

EventName="OnRowCommand"

with

EventName="RowCommand"

and it should work

like image 127
Ovidiu Avatar answered Oct 13 '22 09:10

Ovidiu