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'.
The event is called RowCommand
not OnRowCommand
Replace
EventName="OnRowCommand"
with
EventName="RowCommand"
and it should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With