2016-09-27 4 views
0

내가 서버 측팝업 창

var url = string.Format("../UserPopup.aspx?user_Ids={0}&fromDate={1}&toDate={2}", user_Ids, fromDate, toDate); 
string script = string.Format("function f(){{openDialog('{0}', {1}, {2}, {3});Sys.Application.remove_load(f);}}Sys.Application.add_load(f);", 
            url, 
            "true",  
            1000, 
            300); 
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "someKey", script, true) 

에서 아래의 코드로 팝업 창을 열어 오전의 가까이에 메인 페이지를 새로 고침 아래 자바 스크립트에서 팝업 창을 닫는 코드입니다. 아래 코드는 작동하지 않습니다.

function GetRadWindow() { 
      var oWindow = null; 
      if (window.radWindow) 
       oWindow = window.radWindow; 
      else if (window.frameElement.radWindow) 
       oWindow = window.frameElement.radWindow; 
      return oWindow; 
     } 

function Close() { 
var result = window.confirm("Are you sure you want to close the window!"); 
if (result == true) { 
    var oWindow = GetRadWindow(); 
    oWindow.argument = null; 
    oWindow.onunload = refreshParent; 
    oWindow.close(); 
    return false; 
    } 
} 

function refreshParent() { 
    window.opener.location.reload(); 
} 

window.opener.location.reload();이 전혀 작동하지 않습니다. 이유를 모르겠다.

팝업창을 닫으면 부모 페이지를 새로 고칠 수 있습니까? 지금 여기

먼저, 그것을 위해 부분보기 모델을 사용하여 부분보기 및 기본보기에서 'mymodel'에 코드 아래에 추가 할 수 있습니다
+0

그렇다면 자녀 창을 닫을 수없고 부모를 새로 고칠 수 없다고 말하는 것입니까? –

+0

'Close' 함수에서'oWindow.onunload = refreshParent; '를 제거하면 창을 닫을 수 있습니다. 페이지 만 새로 고침하면됩니다. –

답변

1

사용 OnClientClose 이벤트, 같은 : 콘텐츠 페이지

  function Close() { 
       var result = window.confirm("Are you sure you want to close the window!"); 
       if (result == true) { 
        var oWindow = GetRadWindow(); 
        oWindow.close(someArugment); //pass the argument here. Define it first, of course 
       } 
      } 

이 데모는 작업 예로서이 있습니다에 메인 페이지

 <telerik:RadWindow ID="RadWindow1" runat="server" OnClientClose="OnClientClose"></telerik:RadWindow> 
     <script> 
      function OnClientClose(sender, args) { 
       if (args.get_argument()) { //make the condition more complex, depending on the argument you pass 
        window.location.href = window.location.href; 
       } 
      } 
     </script> 

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window

-1

,

<div class="modal-header"> 
 
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
 
      <h4 class="modal-title" id="myModalLabel">Event Information</h4> 
 
     </div> 
 

 
<div id='myModal' class='modal'> 
 
     <div class="modal-dialog"> 
 
      <div class="modal-content"> 
 
       <div id='myModalContent'></div> 
 
      </div> 
 
     </div> 
 
     </div>

는 닫기 버튼입니다 자바 스크립트 이는 단지 'mymodel'컨트롤 숨기기 정보 파일

$(function() { 
 
     
 

 
     $("#closbtn").click(function() { 
 
      $('#myModal').modal('hide'); 
 
     }); 
 
    });

+0

두 코드가 모두 오류가 발생하고 코드를 사용할 수 없습니다. 이것은 내 코드에서 과감한 변화입니다. 나는 이것을 위해 Telerik RadWindow를 사용하고있다. –

+0

여기에 RadWindow를 사용하고 있습니다. –

+0

서버 쪽에서 팝업 창이 열립니다. 이 때문에 당신의 코드를 사용할 수 없습니다. –