2012-02-10 14 views
1

AspxページのjQueryダイアログを使用してポップアップとしてユーザーコントロール(Child.ascx)を開こうとしています。 Child.ascxChild.aspxにラップしました。今Main.aspxに私はASPXページのjQueryダイアログを使用してポップアップとしてユーザーコントロール(Wrap aspxページ内)を開こうとしています

Main.aspx ..ポップアップとして**Child.aspx**を呼び出したい:

<script type="text/javascript"> 
     $(document).ready(function() { 
      $('#btnMemo').click(function() { 
       $.blockUI({ message: '<h1> Processing...</h1>' }); 
       var ControlName = "Child.ascx"; 
       $.ajax({ 
        type: "POST", 
        url: "Child.aspx/Result", 
        data: "{controlName:'" + ControlName + "'}", 
        contentType: "application/json; charset=utf-8", 
        dataType: "json", 
        success: function (response) { 
         $.unblockUI(); 
      ********* /// Code to open the popup *********** 
         // $('#result').dialog(response.d); 
        }, 
        failure: function (msg) { 
         $.unblockUI(); 
         ///// $('#result').html(msg); 
        } 
       }); 
      }); 
     }); 

    </script> 

.................. 

    <td> 
     <asp:ImageButton ID="btnMemo" runat="server" AlternateText="Memo" CausesValidation="false" ClientIDMode ="Static" /> 
     <div id="divMemoInfo" title="Memo"></div> 
    </td> 

Child.aspx.cs:

[WebMethod] 
    public static string Result(string controlName) 
    { 
     return RenderControl(controlName); 
    } 

    public static string RenderControl(string controlName) 
    { 
     Page page = new Page(); 
     UserControl userControl = (UserControl)page.LoadControl(controlName); 
     userControl.EnableViewState = false; 
     HtmlForm form = new HtmlForm(); 
     form.Controls.Add(userControl); 
     page.Controls.Add(form); 

     StringWriter textWriter = new StringWriter(); 
     HttpContext.Current.Server.Execute(page, textWriter, false); 
     return textWriter.ToString(); 
    } 

Child.aspx

<body> 
    <form id="form1" runat="server"> 
     <div id="result"> 
     </div> 
    </form> 
</body> 

アドバイスをお願いします。

おかげ

BBは

答えて

1

あなたは、ポップアップでchild.aspx開くことができます。 $(「#子」)を使用して

1メインページの隠されたコンテナ内の)負荷child.aspxをロード...

2)ダイアログを使用して、ポップアップを開く:次の2つのステップでこれを達成することができます。 :$( "#子")。ダイアログ...

関連する問題