2

如何在按钮单击事件的模态弹出扩展器中加载 iframe 中的页面?

嗨,我在页面中有一个带有链接按钮的网格(例如:“page1”),当我单击链接按钮时,我需要通过在 a 中传递查询字符串来加载页面(例如:“page2”)我在模态弹出扩展器控件中设置的 iframe。我可以通过在标记中添加这段代码来实现这一点

  <asp:TemplateField HeaderText="PO NUMBER" HeaderStyle-HorizontalAlign="Center" 
      ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
    <ItemTemplate>
      <asp:HiddenField ID="hfPOAID" runat="server" 
      Value='<%# Bind("POAtID") %>'></asp:HiddenField>
      <asp:LinkButton ID="lbtnPO" runat="server" ForeColor="Blue" 
      Text='<%# Bind("PONUM") %>' CommandName="POview" CommandArgument=
      '<%# ((GridViewRow) Container).RowIndex %>' AutoPostBack="True">
      </asp:LinkButton>
<cc1:ModalPopupExtender ID="mpeStatus" OnOkScript="__doPostBack('Ok','')"  
runat="server" TargetControlID="lbtnPO" PopupControlID="pnlPerson" DropShadow="true" 
CancelControlID="ibCancel1" >  </cc1:modalpopupextender>              
<asp:Panel ID="pnlPerson" runat="server" Style="display: none" 
 Width="900px" Height="550px" CssClass="modalPopup">
   <div style="float: right;">
      <asp:ImageButton ID="ibCancel1" runat="server" ImageUrl="~/Images/del.png" 
      Width="20px" Height="20px" /> 
   </div>
   <div>
    <table>
      <tr>
        <td align="center" style="font-size: 14px;">
          <b>View Purchase Order</b>
        </td>
     </tr>
     <tr>
        <td>
          <iframe name="FRAME1" width="800" height="500" frameborder="0" 
              src='<%#String.Format("ShowPO.aspx?Poid={0}", Eval("POAtID"))%>'>
          </iframe>
        </td>
       </tr>
     </table>
   </div>
  </asp:Panel>
  </ItemTemplate>
  <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
  <ItemStyle HorizontalAlign="Center"></ItemStyle>
  </asp:TemplateField>

并在代码隐藏页面中----------------

   protected void gvPOCloseRpt_OnRowCommand(object sender, GridViewCommandEventArgs e)
   {
   try
   {
     if (e.CommandName == "POview")
     {
          int index = Int32.Parse(e.CommandArgument.ToString());
          HiddenField hfPOAID = (HiddenField)gvPOCloseRpt.Rows[index].FindControl
          ("hfPOAID");
          Session["POID"] = hfPOAID.Value;
          string Script = "window.open('http://mak-erp/deverp/Purchase/poprnt.aspx')";
          System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, 
          this.GetType(), "test", Script, true);
     }
   }
   catch (Exception ex)
   {
     Response.Write(ex);
   }
}

但是,如果网格中有大量数据,加载页面需要很长时间,所以,我只需要在网格中链接按钮的单击事件上加载页面吗?......

任何人都可以帮助我做到这一点......

提前致谢...........

迪内什库马尔 R,

4

2 回答 2

1

You can try ThickBox to pop up the page2.

And you can use url query string to pass the POID parameter.

see more information about ThickBox : http://jquery.com/demo/thickbox/

Or you can use ajax to achieve this!

于 2011-06-20T14:24:38.020 回答
0

尝试使用 jQuery modal popup 引用一个 div,该 div 又包含一个 iframe 来显示页面。喜欢 :

$('#btnOpenPopup').click(function (e) {
    $('#frmLoadPage').attr('src','your_page_url');
    $('#divContainer').modal();
    return false;
});

<div id="divContainer" class="form-control">
  <iframe id="frmLoadPage" ></iframe>
</div>
于 2012-02-24T06:47:52.270 回答