[英]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. 我希望
GridView
的OnRowCommand
事件不在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.