gpt4 book ai didi

c# - 更新面板触发器 : Could not find an event named 'OnRowCommand'

转载 作者:太空狗 更新时间:2023-10-29 22:19:11 26 4
gpt4 key购买 nike

我希望 GridViewOnRowCommand 事件不对 ErrorLinkBut​​ton 单击执行完整回发。所以我将控件包装在一个更新面板中,并为 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>

但是我得到以下错误:

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

最佳答案

该事件称为 RowCommand 而不是 OnRowCommand

替换

EventName="OnRowCommand"

EventName="RowCommand"

它应该可以工作

关于c# - 更新面板触发器 : Could not find an event named 'OnRowCommand' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19767959/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com