c#
  • asp.net
  • popupwindow
  • aspxgridview
  • 2016-11-17 2 views 0 likes 
    0

    좋아, 이건 너트를 돌리고있어. 가능한 해결책을 시도했지만 작동하지 않습니다. 내 상위 페이지에있는 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> 
    

    모든 지원에 감사드립니다.

    +0

    가능한 중복이를 추가해야합니다. com/questions/1777864/실행 방법 - 부모 - 창 - 자식 창 - 닫을 때) – melancia

    답변

    0

    이것은 정말로 흥미 롭습니다. 다음 코드로 문제를 해결했습니다. 이렇게하면 C# 업데이트 전에 javascript 함수가 실행되지 않습니다. // 유래 :

    <asp:placeholder id="refresh_script" visible="false" runat="server"> 
            <script>   
             window.opener.location.reload(); 
             window.close();      
            </script> 
            </asp:placeholder> 
    

    은 그럼 당신은 .cs 뒤에 코드에 [? 자식 창을 닫을 때 부모 윈도우의 기능을 실행하는 방법 (HTTP의

    refresh_script.Visible = true; 
    

     관련 문제

    • 관련 문제 없음^_^