如何从iFrame内部页面访问父页面中的用户控件 [英] How to access the user control in parent page from page inside the iFrame

查看:78
本文介绍了如何从iFrame内部页面访问父页面中的用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,
我有使用母版页的页面,它具有以下
1.用户控件(ucMessage)
2. iframe(frmrevrec)

我想要的是,从iFrame中,我想使用jquery使控件的可见属性变为父页面中用户控件的真实设置值.

我在iFrame中尝试了以下操作:

Hi friends,
I have page which uses master page, it has following
1. user control(ucMessage)
2. Iframe(frmrevrec)

What I want is, from iFrame i want to make the control visible property to true set value of user control in parent page using jquery.

I tried following in iFrame:

$(document).ready(function () {
                var obj = $('#tblMessage').find('#ucMessage');
                var obj1 =
                if ($('#ucMessage').style.display == 'none') {
                    alert(obj + "hi");
                    obj.style.display = 'block';
                }
                $('tblMessage').find('#ucMessage').value = 'Hi';
            });



但这不能正常工作.

这是父页面的aspx



But it is not working fine.

This is aspx for parent page

<asp:Content ID="Content1" ContentPlaceHolderID="cphPage" runat="server">
      <asp:UpdatePanel ID="pnlUpdateMessage" runat="server" UpdateMode="Conditional">
        <contenttemplate>
            <table id="tblMessage" style="width: 100%">
                <tr>
                    <td>
                        <uc:ucmessage_ascx ID="ucMessage"  runat="server" />
                    </td>
                </tr>
            </table>
        </contenttemplate>
    </asp:UpdatePanel>
        <iframe id="frmrevrec" src="wf_ProjectEstimates.aspx" width="100%" scrolling="no" frameborder="0" height="100px"></iframe><br />
</asp:Content>




知道怎么做吗?

在此先感谢




Any idea how to go about it??

Thanks in advance

推荐答案

(document).ready(function(){ var obj =
(document).ready(function () { var obj =


(' ' var obj1 = 如果(
('#tblMessage').find('#ucMessage'); var obj1 = if (


(' ' " ); obj.style.display = ' block'; }
('#ucMessage').style.display == 'none') { alert(obj + "hi"); obj.style.display = 'block'; }


这篇关于如何从iFrame内部页面访问父页面中的用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆