在弹出对话框中渲染部分页面

时间:2013-05-01 09:08:05

标签: c# javascript html

我正在尝试将部分视图加载到弹出对话框中。

我已经为对话框创建了有效的代码。我想知道如何将这个局部视图加载到对话框中,虽然链接点击下面提供的关于链接java script and popup dialog box的所有代码。

HTML代码:

<div id="mediaContainer" class="jqmDialog" style= "width:750px; left:23%; top:18%; height:525px; ">
   <div class="jqmnTitle jqDrag">
    <h1>Subscriptions</h1>    
    </div>
    <img class="jqmClose" style="position: absolute; cursor: pointer; right: 2px; top: 2px;" onclick="closeDialog();" src="@VirtualPathUtility.ToAbsolute("~/Content/images/close.gif")" 
            alt="Close" height="20px" width="20px" />

      <center>  
        <div id="divpart"></div>

       </center>
 </div>

JAVA脚本:

   function renderPart(element, templateId) {
       makeDialogBox();
jQuery.get(FBUrl, { id: templateId }, function (data) {
               // alert(data);
               $("divpart").append(data);
       });

   }

超链接:

<a href="#" style="text-decoration: underline;" class = "lnkShowMarketRates" onclick="renderPart(this.id, @item.id);">Subscriptions</a>

2 个答案:

答案 0 :(得分:0)

使用本机javascript或jquery将XMLHttpRequest设置为部分视图的URL,并将输出附加到模式对话框中的div之一。我正在使用jquery

          function renderPart(element, templateId){
           $.ajax({
             url : '',
             type : 'GET',
             succsess : function(response)
             {  $("#divIDinsideModalBox").html(response); makeDialogBox();   }
           });
         }

答案 1 :(得分:0)

jQuery.get("InsertURLHere", { id: templateId }, function (data) {
               // alert(data);
               $("divpart").append(data);
       });