Reputation: 363
Iam having two pages Parent.aspx and Child.aspx
Iam using IFrame to show my Child.aspx from parent like this
<div id="Omit" class="Omit" style="display:none">
<iframe src="Omission.aspx" width="1000" height="600"></iframe>
</div>
In my Omission.aspx iam having a label in which i get values from Parent to show in that label
<div class="Right">
<p>
<strong style="color: #000;">Omit</strong>
<asp:Label ID="lblOne" runat="server" CssClass="lblOne" ClientIDMode="Static" ></asp:Label>
</p>
</div>
Here when i assign Text to label iam not getting
var Text = $(".ddlName option:selected").text(); //Dropdwon of Parent.aspx
i need this value to be assigned to Label which is in Iframe i have tried these ways as
$(".lblOne").text($(".ddlService option:selected").text())
$(".lblOne").text(Text);
$('#<%= lblOne.ClientID %>').html(Text)
$('#<%= lblOne.ClientID %>').text(Text)
Iam unable to bing Text to that Label.., Can anyone please help me out from this small situation of assigning, Thanks in Advace
Upvotes: 0
Views: 1919
Reputation: 73926
Try this:
// Get the iFrame jQuery Object
var $MyFrame = $("#iframeid");
// You need to wait for the iFrame content to load first
// So, that the click events work properly
$MyFrame.load(function () {
var frameBody = $MyFrame.contents().find('body');
// Find the label
var $label = frameBody.find('.lblOne');
// Set the label text
$label.html(Text);
});
Upvotes: 2