在我的Usercontrol页面中,更新面板在gridview中不起作用。我使用了以下方法,但没有任何效果。任何人都可以帮助我。
方法1:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="gvClaimMasterDiv" runat="server" style="overflow: auto; height: 550px; margin: 0 auto; width:950px; border: 1px thin blue">
<asp:GridView ID="gvClaimMaster" runat="server" AllowSorting="True" ShowFooter="True" GridLines="Vertical" Width="950px"
Font-Size="Small" Font-Names="Calibri" CellPadding="4" AutoGenerateColumns="False" EmptyDataText="No Records Found" ForeColor="#333333"
OnSelectedIndexChanged="gvClaimMaster_SelectedIndexChanged" DataKeyNames="ClaimMasterId, AllocationId"
OnRowDataBound="gvClaimMaster_RowDataBound" OnRowEditing="gvClaimMaster_RowEditing" OnRowCancelingEdit="gvClaimMaster_RowCancelingEdit"
OnRowUpdating="gvClaimMaster_RowUpdating" OnDataBound="gvClaimMaster_DataBound" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="EditBtn" CommandName="Edit" runat="server"
ImageUrl="~/Img1/edit.gif" ToolTip="Edit Chart# / Claim#" Height="20px" Width="20px" />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="UpdateBtn" CommandName="Update" runat="server"
ImageUrl="~/Img1/save.gif" ToolTip="Save" Height="20px" Width="20px" />
<asp:ImageButton ID="CancelBtn" CommandName="Cancel" runat="server"
ImageUrl="~/Img1/cancel.gif" ToolTip="Cancel" Height="20px" Width="20px" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<p></p>
</div>
</ContentTemplate>
</asp:UpdatePanel>
方法:2
我使用了UpdateMode =“Conditional”,如下所示
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gvClaimMaster" />
</Triggers>
方法:3
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gvClaimMaster" EventName="RowEditing" />
</Triggers>
方法:4 将UpdateMode更改为Always并删除了Triggers
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">
方法:5 给定ItemTemplate内的更新面板
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="EditBtn" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="EditBtn" CommandName="Edit" runat="server"
ImageUrl="~/Img1/edit.gif" ToolTip="Edit Chart# / Claim#" Height="20px" Width="20px" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
答案 0 :(得分:1)
最后,我确定了问题 - ASP.NET AJAX UpdatePanels&amp; jQuery函数。感谢Hajan Selmani和他的post。
ModalPopupExtender阻止UpdatePanel函数。所以我从aspx页面中删除了弹出脚本,并将其添加到Page_Load的代码隐藏中,如下所示
ClientScript.RegisterClientScriptInclude(this.GetType(), "myScript", "Style/gvAJAX/popup.js");