accessing a server side function in a parent page from a server side function found in a page in an iframe

I was wondering if this was possible. I current have a page with a menu where when a menu item is clicked the iframe directly underneath would populate with a specified page based on menu item. From here I would like to access a function based in the parent page when something in the iframe is accessed. Or the very least access the attributes such as the height or width of the main window compared to the iframe from the iframe's page's server function.

I am trying to display a separate window for the user through javascript like a modal window which i want to fill up the whole window however, the modal window is following the size of the iframe instead. Any help would be great thanks! 

0
Mr
12/29/2008 7:59:02 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
1106 Views

Similar Articles

[PageSpeed] 44

Yes you can do it!

For example:

Put this code in the master page:

<script type="text/javascript" language="javascript">function redirect(varClientId)

{

 

document.getElementById(varClientId).style.width = "700px"; // watever height or width you want to give.

document.getElementById(varClientId).style.height = "700px";// watever height or width you want to give.

 

 

}

</script>

Pass the iframe client id to the opening page in the query string. and then retrieve the variable there from the query string

on the opening page add the script to call the master page function:

<script type="text/javascript" language="javascript">

function change(varCI)

{

window.parent.redirect(varCI);

}

</script>

 

btnSave.Attributes.Add("onclick", "javascript:change(" & strClientId & ");")

Dim strClientId As String = Request.QueryString("var").ToString();

you will be able to call the function in this way and you can access the controls width and height etc.

 


Nilee

Please mark the post as 'Answer' if it helps you!!
0
Nilee
12/30/2008 5:04:14 AM
Reply:

Similar Artilces:

Accessing server-side control in client-side javascript function; on Content page
I am trying to set an asp:textbox value in the Client side javascript function. It works fine on the standalone page. But when i try to do this the Content page, it’s giving the follwoing error message. document.getElementByID[...] is null of not an object  Any idea? Thanks, Riz   Hi, are you using ClientID property of that server control, to get its ID (which is rendered at the client and can be used with document.getElementById )?Thanks,Teemu KeiskiFinland, EU Thank you my problem is solved....

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

Call server-side page function from client-side button click
I have an existing ASP application that I am migrating to ASP.net. In the ASP app I was using the Microsoft.XMLHTTP on a the client-side of a ASP page to retrieve data from another asp page using the Microsoft.XMLDOM object. The client page passes 3 tags columns, table and Criteria. The receiving page builds the SQL statement executes the query and returns the row with all the column data. I am trying to convert it over to ASP.NET and I am getting errors on the xmlDOM.Load(Request.InputStream) on DLookup.aspx, the code is listed below. Someone suggested to use System.Net HTTP classes su...

i need help --can i call function written on server side insid (run at server) inside function written on clinet side
hi every one.i am using java script to call  setTimeout() functionand i want to call myfunction () inside setTimeout()setTimeout(myfunction(); time)but the myfuction() is written in Codebehindplease i want to know if i can do that if it is possible, how i can do that This might work:<JavaScript>setTimeout("timedFunction()", time) function timedFunction(){ __doPostBack('TimerFunction', '');}</JavaScript> // CodeBehind Page_Load event handlerprivate void Page_Load(object sender, System.EventArgs e){ // Insure that the JavaScript __doPostBack method is a...

How to call server side(C#) function from Client side(Javascript) function?
Hi i have used below functions,  function HandleOnClose() {// this function will be called after clicking browsers close button in Internet explorer if (event.clientY < 0) { event.returnValue = 'Are you sure you want to leave the page?'; } // if he clicks ok then i need to call one server side function in this instance.. else not. } <body onbeforeunload="HandleOnClose()" leftmargin="0" rightmargin="0">other controls in page..</div>  How to achieve this? Thanks MS AJAX Extensions would be the option of choice here. Combined with webservices you can...

Problem accessing server side array values from client side javascript function
i faced the following problem ..i have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>;...

Problem accessing server side array values from javascript client side function
i faced the following problem ..i have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>; First of all, you can't mix server-side and client-side code. The reason is that the protocol that is used to communicate betwee...

Problem accessing a server side declared array from the client side javascript function.
I have an array that store the values of a resultset row under the server side coding.How do i retrieve them under my client side javascript function.I wrote the following coding under my client side function and it got an error.BSCStr is an array storing data from a resultset row which i did under the server side coding. From client side javascript function: addr=addr + "&C" + i + "=" + <%=BSCStr[i]%>; Hi wingshya, Did you still need help with this thread? Jason ConwayMCP, MCTS, Certified SCRUM Masterasp.net blog...

Setting the value of server side variable in javascript and wants to use that server side variable on page load.
Hi, I am trying to set the value of a server side variable in javascript and wants to use that variable on page load.  Here is my sample code. -------------------------- private string testVal = null;  private void registerScript(){ if (!this.Page.ClientScript.IsClientScriptBlockRegistered("RequestHeaderValidation")){ StringBuilder sb = new StringBuilder("" + Environment.NewLine);sb.Append(" var version = '2.0'; " + Environment.NewLine); sb.Append(" var isInstalled = Silverlight.isInstalled(version);" + Environment.NewLine)...

Call Server Side method from JavaScript function in Master Page
 I have a JavaScript function in a Master Page. The function is below. function Add(q, p) { //call server side method }  I want to be able from within the JavaScript Add function defined above, call a C# server side method and pass the values q and p to it. No value is returned.I have tried PageMethods.CallServerSideMethod(q, p); but it will only work in a Page, not a master page.Is there any way I can do this in a master page?  How about using a web service call?Encosia - ASP.NET, AJAX, and more.Latest article: Using complex types to make calli...

Page.render giving the A page can have only one server-side Form tag error
Hi I am trying to get the current pages output (html) as string and send it to a different server. I have the following code Dim sResultantHTML As StringDim sb As New StringBuilder Dim SW As New StringWriter(sb)Dim htmlTW As New HtmlTextWriter(SW) Page.RenderControl(htmlTW)Dim pageHTML As String = sb.ToString() htmlTW.Flush() sResultantHTML = SW.ToString() htmlTW.Close() But upon executing I am getting the 'A page can have only one server-side Form tag error'. My page is in ASP.NET 1.1 with VB.NET code behind. Can somebody help   Thanks GVI Do you have two FORM...

server side or client side page?
a page that contain a validation control and starting a storeProcedures when the user click on a button --is considered as a client side page or as a server side page?it seems to me that in asp.net everthing is server side, where are the client side pages?thanks The sp is server side, but the validation can be on or the other, depending on how it's coded.ASP.Net has it's validations, so it's server side when using them.But you can also make validations via JavaScript, so that would be client side.Zath but the validation controls (like RequiredFiledValidator) is a client side va...

Accessing the parent page from the child page that is in iframe of parent page
Is is possible to get a reference to the controls of the parent.aspx page from child.aspx page, which is actually referenced from the parent page through iframe tag. I have an ParentPage.aspx with an Iframe in it. I set a child page ChildPage.aspx to the Iframe programatically using Attributes("Src")  from the ParentPage.aspx.  Now, is there a way for me to get hold of the controls of parent page from the child page. If I do something like this in child.aspx.cs class Parent. It shows that parent is empty. Please help... thanks -SarahSarah Cameron Benjamin H...

problem i refreshing the parent page when the popup/child page done the server side processing and closes itself
Hi, I have one parent page and one popup page.  The dropdown will show all the available companies.   Now when I click the “Add new Company” button the popup window will come .      Now here we will put new company details and click the “Save button”. On clicking the save button this page should do the following.   1.store the values in the database. 2.Populate the parent window dropdown with the newly added value. 3.Heighlight the values corresponding to the newly added company. 4. Close itself.   What I was trying to do was, First u...

Web resources about - accessing a server side function in a parent page from a server side function found in a page in an iframe - asp.net.web-forms

Highest Percentage Of Opera Mini Users Accessing Facebook? Macau
If you were asked to guess which country had the highest percentage of users of Opera mobile Web browser Opera Mini users accessing Facebook ...

International Users Accessing Facebook Places Through US VPN Accounts
By using a virtual private network (VPN) hosted in the United States, Facebook users from around the world are accessing Facebook Places. The ...

What are some alternatives to Yodlee for accessing bank information?
Clay Loveless , Founder, Jexy. Co-founder, Mashery. Founder, Jexy. Co-founder, Mashery.

Cloud Console - Accessing files in cloud storage for iPad on the iTunes App Store
Get Cloud Console - Accessing files in cloud storage on the App Store. See screenshots and ratings, and read customer reviews.

Meryl Streep On Accessing The Characters Within - YouTube
Meryl Streep talks about the importance of an actors work representing their ability. CONNECT WITH AFI: http://facebook.com/AmericanFilmInstitute ...

Student pleads guilty to accessing records about Frances Abbott design scholarship
The Sydney student who leaked information about a fashion school scholarship controversially awarded to the daughter of the Prime Minister has ...

Accessing a headline opinion
Accessing a headline opinion

Sharp increase in authorities accessing private data
Australian law enforcement and government agencies have sharply increased their access without warrant to vast quantities of private telephone ...

Former librarian charged with accessing student records of Frances Abbott
A former part-time librarian at a Sydney design school has been charged after she allegedly accessed student records of Prime Minister Tony Abbott's ...

Frances Abbott scholarship: Sydney woman pleads guilty to accessing Whitehouse Institute records on PM's ...
A Sydney woman who leaked the student records of Tony Abbott's daughter pleads guilty. A Sydney woman who leaked the student records of Prime ...

Resources last updated: 1/16/2016 7:49:21 PM