.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to add iframe in MVC?

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

I have a controller called Test and there are two methods in it, one is MultipleSelect and the other is DisplaySelectedSubjects. The view for MultipleSelect has been set up and is working properly. Now I want to add a iframe in the view of DisplaySelectedSubjects to display the content of MultipleSelect. Both views are in the same folder Views/Test in the MVC project. I did the following:

<iframe src="MultipleSelect.aspx" width="300" height="400">

Yet the iframe display an error message: "The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable."

Can someone explain why it does not work? And how to make it work? Thank you.

View Complete Post

More Related Resource Links

JavaScript iframe resezing issue



I have an iframe that is supplied by another application, inside the iframe I have my .Net application. However, I am having sizing issues, where one minute that pages in the .Net fit the frame perfectly and the next minute they don't, with a vertical and horizontal scroll bars appearing. All the .Net Pages use a Master Page and I have also fixed the size of the pages, but with no luck. What I would was thinking if possible is to pass some javascript between the .Net application and the iframe which will make the pages and the iframe resize themselves. Has anyone done this before and have some code that I could use?

iframe and setfocus problem


I have a page with an iframe on it in which I load another page.
On this iframe page I have some textboxes above eachother.

When the first textbox is filled with a code the textchanged event is called 
and the code is checked with the database.
After the code has been changed to the right one (if needed) I want the 
focus to go to the next textbox.

So at the end of the event I do: Page.SetFocus(txtbox2)

But after the postback refresh, the focus is gone.
I have also put the control to be focussed in a session variable and then in the page_load event I set the focus to the control in the session variable, but still no focus on the textbox.
How can I put it on the 2nd textbox? 
all is done in the Iframe page codebehind.
I need this focus because the two textboxes are filled via bar code reader and after the scan an "enter press" is done automatically and to be able to allow two scans after each other this focus change is needed.

Do Post to Iframe in same page, and Password Field


Hi all,

I need do post of a form in my page to Iframe in the same page.

I set target in form tag.

<body onload="document.formuno.submit()">

                               <form name="formuno" method="post" action="http:\\externalCompany.WebForm.aspx" target="framename"  >

                                               <input type="hidden" name="prueba"  value="pruebatxt" runat="server">

<input type="hidden" name="prueba2"  value="pruebatxt" runat="server">

<input type="hidden" name="prueba3"  value="pruebatxt" runat="server">

<input type="hidden" name="password"  value="MY PASSWORD" runat="server">


IFrame onload event


The code below I am having problems with. I have a page with multiple views. When the 2nd view loads up I want an animated gif to appear untill the pages loads up in the iFrame.

In the onload event inside the iframe I try to call a javascript function. I get the following error when I try to call the javascript function:

'ASP.applications_onlinebillpay_payment_aspx' does not contain a definition for 'hideLoading' and no extension method 'hideLoading' accepting a first argument of type 'ASP.applications_onlinebillpay_payment_aspx' could be found (are you missing a using directive or an assembly reference?)

If I take out the runat="server" part it will work but I need to assign the src of the iframe in my c# code.

The code is:

<asp:View ID="View2" runat="server">
         <script type="text/javascript">
            function hideLoading() {

thickbox iframe



i facing scenario is that i want to call my page in thickbox using i frame  in server side code

below the code  i tried. i want to pass the my aspx page

protected void Button1_Click(object sender, EventArgs e)
      ShowDialog(this, "Security Question & Answer", 500, 300, "sampleContent");
      TextBox1.Text = "workingmaster";

public static void ShowDialog(Page page, string title, int width, int height, string divTag)
      string script = "$(document).ready(function() {tb_show('";

// i want to pass my aspx page here

      script += title + "', '#TB_iframe=true    height=" + height.ToString();
      script += "&amp;width=" + width.ToString();
      script += "&amp;inlineId=" + divTag + "', null);});";

      ScriptManager.RegisterStartupScript(page, page.GetType(), "", script, true);

determine the screen height within javascript and set a property on an iframe


I have a webform  that has a header and iframe,  what I need to do is on load detemine the users screen height and then  set the height on the iframe. Can someone explain  or show me an example of how to do this.

Thanks in advance.

Clicking button and view in iframe


When i place the button in the website and i click the button,it runs as a full page.But i ant the website to run in the iframe.How do i do that?Because i want to place many button for different uses so i need it to view in iframe instead of a full page

open Word document in iframe without open/ save dialouge

Hello All! In my application users upload their word document and user has been given an option to preivew the uploaded document. Inorder to  preview  the document  i put the following code in my page_load eventdiv1.InnerHtml = "<iframe name='iframe4' src='DocumentUuploaded/report.doc ' target='iframe4'  frameborder='no' height='500' scrolling='no' width='800'></iframe>";The problem is it is asking Do you want to open or save this file. How can i get rid of this dialouge box . Pls helpThanks in advance.

Work around cross scripting issue (iframe)

I want to know how I can get the button in the iframe to send the selected item in the dropdown box to a text box that is out side of the iframe. The setup is as follows This is the source of the Php page. The iframe receives the controls from the aspx page on another website. 2 separate websites. The asp.net site sends a dropdown box a label and a button to the page below (php page):<iframe id="hdnFrm" name="hdnFrm" src="" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%; height:50px"></iframe> <form action='http://www.link-exchangers.com/adv_links_addbycustomer.aspx' target='hdnFrm' method='post'> <table width=90% align=center cellpadding=2 cellspacing=0 border=0> <tr><td valign=top>Contact email: </td><td><input type=text name=web_email value="" style='width:250px'></td></tr> <tr><td valign=top>Web site title: </td><td><input type=text name=web_title value="" style='width:250px'></td></tr> <tr><td valign=top>Your url: </td><td><input type=text name=web_url value="http://" style='width:

Javascript to pass var in iframe to parent form

Why doesn't this form work when the button is clicked? It is inside an iframe. I sent the controls to an iframe from  a different website. When I hover my mouse over the Resubmit button, I can see the correct url in my browser bar. (lower left) This is the same one as the save button. Does the fact that the Resbmit button is in an iframe create a problem?  Is this a security issue?   I was trying to use the Copy url to clipboard button to copy the selected url in the dropdown to the clipboard. Then the user could paste it into the Recipcocal url field in the form and click the Save button again. (see picture) The form is on the page with the iframe. The copy button doesn't work either.  <form name="ctl01" method="post" action="http://www.link-exchangers.com/adv_links_addbycustomer.aspx" id="ctl01" target="hdnFrm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUaUXIyTcD6f05q0zIbv4QVbpto4s=" /> </div> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="//2DwKU+M6MDwK8m8+dCQKy8rjSBwLD+aWMBALcwYfHCALrp+eHDwKggI3ODAKvtqqBBgKjs8y4CAKqiLHeDgK34agCBNfAteTeI3XoiXVXjCs/J0yEnNM=" /> </div>

How to resize iframe when content loads..

I have an iframe on website A which receives the controls from website B once the form is processed on website B. Here is the page on website A with the iframe. I have hard coded the height at 100px:<iframe id="hdnFrm" name="hdnFrm" src="" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%;height:100px"></iframe> <form action='http://www.link-exchangers.com/adv_links_addber.aspx' target='hdnFrm' method='post' name='form1'> <table width=90% align=center cellpadding=2 cellspacing=0 border=0> <tr><td valign=top>Contact email: </td><td><input type=text name=web_email value="<?=$web_email;?>" style='width:250px'></td></tr> <tr><td valign=top>Reciprocal link: </td><td><input id=web_recip type=text name=web_recip value="<?=$web_recip;?>" style='width:250px'></td></tr> <tr><td colspan=2 align=center><input type=submit value="Save" style='width:100px'></td></tr> </table></form> Once the Save button is clicked, website B processes the data in this form, and sends messages and a

javascript not working in iframe on remote site

<html> <body style="background-color: White;"> <form name="ctl01" method="post" action="adv_links_addbycustomer.aspx" id="ctl01"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/</div> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/dfdafa" /> </div> <div style="background-color:White;"> <span id="lblMsg" class="ErrorText" style="font-weight:bold;"></span> <center> <span id="Label1" style="font-size:X-Small;font-weight:bold;">Valid Urls</span> <select name="DropDownList1" id="DropDownList1" style="background-color:#EFEFEF;border-color:#898989;border-width:1px;border-style:Solid;font-size:8pt;padding:0px;"> <option value="0"> - Select - </option> <option value="http://www.fha-home-loans.us/index.htm">http://www.fha-home-loans.us/index.htm</option> <option value="http://www.fha-home-loans.us/jumbomortgage/apply.htm">http://www.fha-home-loans.us/jumbomortgage/apply.htm</op

Form in iframe doesn't work.

I have put a form into an iframe. It is sent from another website to the php page on the site which has the iframe. Upon clicking the submit button nothing happens. Just a quick flash of the green page load bar. Why is this happening? I have spend hours on this...<%@ Page Language="VB" AutoEventWireup="false" EnableEventValidation="true" CodeFile="adv_links_addbycustomer.aspx.vb" Inherits="users_adv_links_addbycustomer" title="" %> <html> <head runat="server"> <title></title> <script type="text/javascript"> function copy() { var sel = document.getElementById("DropDownList1"); var text = sel.options[sel.selectedIndex].value; // Assigning selected value of DropDownList to a hidden TextArea holdtext.innerText = text; // Creating text range from hidden TextArea's content CopiedTxt = holdtext.createTextRange(); // Copying the text range to clipboard CopiedTxt.execCommand("Copy"); // out = parent.document.getElementById("web_recip"); out = document.getElementById("Textbox6"); out.value = text + "

Reload IFrame+ModalPopUpExtender Content

Hi all, I have a small issue with ModalPopupExtender. It opens in an Iframe initially, and shows the page: add_contact.aspx After I have entered the contact details, the IFrame redirects to the contact_details.aspx page to show what I have loaded. The problem is when I close that modalpopup-window and click again to show the modalpopup, the iFrame shows the contact_details.aspx page, and not the add_contact.aspx page. Anyways, I can resolve this, without using modalPopup.show() in code behind? Thanks

How do I change the height of a remote iframe

<iframe id="hdnFrm" name="hdnFrm" src=""   scrolling="yes" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%;height:90px"></iframe>   here is my iframe. This in on a php page on a different website. Right below the iframe is a form. The form posts variables to a page on my vb.net website. The codebehind processes the data in the form. The results of processing are sent back to the iframe above. When this happens instead of the height beinc 90px, I want to change it to a different number. How can i do this? Do I set up some type of "listener" for when the controls arrive? I read this somewhere.   


I am using an IFRAME in IE8 to try to display a pdf.  I have my home page, home.aspx.  This page has an IFRAME on it and a tree of documents that relate to the individulats pdf's that are available.  I am setting the src of the IFRAME on the onNodeSelect event of the tree via Me.docframe.Attributes("src") = e.Node.Value.  The value of the node is a page named image.aspx.  This page accepts three parameters in the query string.  The page goes out and finds a document stored on our DAS, converts the pdf to a byte array and then returns the pdf as a byte array in the httpresponse.  Everything works great when I run the site via http.  The problem comes in when I configure the site to run via https.  I know it is due to IE8's new security to try to avoid click-jacking.  IE8 no longer allows us to set the src of an IFRAME to a url that is not in the domain.  The page image.aspx is in the domain?  As a test I put the test pdfs in a "docs: folder in the virtual directory and things worked as needed via https.  The problem is I must store the pdf's on the DAS and the virtual directory must be on the web server.  Does anyone hava any idea how I can accomplish this?Thanks,Russ

Close Thickbox From Button Click inside of iframe

I know this question has been asked several times, but all fo the answers I found did not work for me.I have a jQuery Thickbox that pops up and display's an iframe.  Within the iframe, there is a button that will sumit the form and then I would like thickbox to close as well.From what I have found, adding the command "parent.document.tb_remove()" to the OnClick tag in the button shoudl work but I keep getting the error:  Compiler Error Message: BC30456: 'document' is not a member of 'System.Web.UI.Control'.Here is the code of the aspx page that opens in the iframe:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LeagueEmail.aspx.vb" Inherits="LeagueEmail" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <link rel="Stylesheet" type="text/css" href="CSS/mf42_layout1_setup.css" /> <link rel="Stylesheet" type="text/css" href="CSS/mf42_layout1_text.css" /> <link rel="stylesheet" href="CSS/thickbox.css" type="text/css" media="screen" /> <title></tit
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend