如何在按钮单击事件的模式弹出扩展器中的 iframe 中加载页面?
如何在按钮点击事件的模态弹出扩展器中加载 iframe 中的页面?
嗨,我在页面中有一个带有链接按钮的网格(例如:“page1”),当我单击链接按钮,我需要通过在我在模式弹出扩展器控件中设置的 iframe 内传递查询字符串来加载页面(例如:“page2”)。 添加这段代码来实现这一点
<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,
How to load a page in iframe which is in a modal popup extender on button click event?
Hi i have a grid with a link button in a page(say for example: "page1"), When i click the link button, i need to load a page(say for example: "page2") by passing a querystring inside a iframe which i have set in a modal popup extender control. I can acheive this by adding this piece of code in markup
<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>
And in the Code Behind page----------------
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);
}
}
But, if there is bulk data's in grid, it take too long time to load a page, So, I need to load the page only on a click event of link button in grid?......
Can anyone help me out to do this.....
Thanks in advance...........
Dineshkumar R,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用ThickBox弹出页面2。
并且您可以使用 url 查询字符串来传递 POID 参数。
查看有关 ThickBox 的更多信息: https://web .archive.org/web/20120502133946/https://jquery.com/demo/thickbox/
或者你可以使用ajax实现这一点!
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 : https://web.archive.org/web/20120502133946/https://jquery.com/demo/thickbox/
Or you can use ajax to achieve this!
尝试使用引用 div 的 jQuery 模态弹出窗口,该 div 又包含 iframe 来显示页面。喜欢 :
Try using jQuery modal popup referring a div which in turn contains an iframe to display the page. Like :