【发布时间】:2011-06-19 19:44:39
【问题描述】:
我在 UpdatePanel 中有一个 GridView。在模板字段中是我用于标记项目的按钮。从功能上讲,这可以正常工作,但该按钮始终会触发整页回发而不是部分回发。如何获取触发部分回发的按钮?
<asp:ScriptManager ID="ContentScriptManager" runat="server" />
<asp:UpdatePanel ID="ContentUpdatePanel" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:GridView ID="OrderGrid" runat="server" AllowPaging="false" AllowSorting="false"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="MarkAsCompleteButton" runat="server" Text="MarkAsComplete"
CommandName="MarkAsComplete" CommandArgument='<%# Eval("Id") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="LoadDate" HeaderText="Load Date" />
<asp:BoundField DataField="EmployeeCutOffDate" HeaderText="Cut Off Date" />
<asp:BoundField DataField="IsComplete" HeaderText="Is Completed" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
【问题讨论】:
-
我在一个新项目上创建了这个场景。我无法让您的完整回发发生,每次都是部分回发。在您的情况下,您还能想到其他奇怪的因素吗?
-
你能在“MarkAsComplete”命令上发布你正在做什么的代码吗?
-
确保您没有在 Firefox 上使用网络开发工具禁用所有 javascript。
标签: c# asp.net gridview asp.net-ajax updatepanel