これは私のナッツを実行しています。私は可能な解決策を試したが、それは動作していません。親ページを子ページからリフレッシュしない
ここに問題があります:
私は親ページにgridviewを持っています。子ページで
<asp:Button ID="Button1" runat="server" CausesValidation="false" CommandName="" Text="Edit" OnClientClick='<%# Eval("ID", "window.open(\"EditFrm.aspx?ID={0}\", null, \"width=700,height=600,top=100,left=300\", \"true\");") %> '/>
、私はDBからすべてのフィールドを移入し、DABにすべてのセーブデータを「更新」をクリックすると、現在のページを閉じる:各行は新しいページを開き、「編集」ボタンを持っています:
<script>
function RefreshParent() {
window.opener.document.getElementById('Button1').click();
window.close();
}
</script>
Button1には、DBからGridviewデータをリフレッシュする方法が含まれています。
私は、次のコード試してみましたが、それはGridViewのをリフレッシュしません。ここで
window.opener.location.reload(true);
は私の親ウィンドウでGridViewの定義です:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" AutoGenerateDeleteButton="True" OnRowDeleted="GridView1_RowDeleted" OnRowDeleting="GridView1_RowDeleting" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CausesValidation="false" CommandName="" Text="Edit" OnClientClick='<%# Eval("ID", "window.open(\"EditFrm.aspx?ID={0}\", null, \"width=700,height=600,top=100,left=300\", \"true\");") %> '/>
</ItemTemplate>
</asp:TemplateField>
// Column definition
<Triggers>
<asp:AsyncPostBackTrigger ControlID="GridView1" />
</Triggers>
</asp:UpdatePanel>
任意のサポートが理解されます。
が重複する可能性を、これを追加する必要があります。 com/questions/1777864/how-to-run-function-of-parent-window-child-window-closes) – melancia