Click here to Skip to main content
16,007,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
$(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';
            });


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
Posted
Updated 11-Sep-12 23:12pm
v2

1 solution

Here is what I did
Parent Page JavaScript:
<script type="text/javascript">
        function setMessage(strMsg) {
            document.getElementById('<%= lblMessage.ClientID%>').innerHTML = strMsg;
        }
</script></script>


And this is how i called it through the iFrame
<script>
 top.setMessage('hello');
</script>


And it working fine :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900