add jquery tab from outside page - asp.net

I have an application that uses jquery tabs to open up different asp.net applications from its "menu" tab. The content of the tabs is an iframe with the application. What I need is for one of the application tabs that is inside an iframe to open a page in a new tab. I am running the apps in iis 7 with asp.net. how can I send a signal to the "tabs" application to open a new tab?

window.parent will allow you to access the outer app.

as #Anthony suggested you can use window.parent and window.parent.document to access objects on the parent window containing iframe, but better way will be to write a function on parent window to open new window and then call that from iframe code because it is more foolproof.
//in parent window
window.openNewWindow = function(/*ANY PARAMS*/){
//open window here
};
//in iframe
parent.window.openNewWindow(/*PARAMAS (IF ANY)*/);

Related

Without reloading bring to view page

Click from parent window open a child window using window.open("url","name").If again clicked the parent for opening the child window then check if the child window is already opened.if it is already opened then bring to view that page without reloading otherwise open in new window.
If you want to open the popup window using window.open() itself then check this thread
Check if a popup window is already open before opening it using Jquery
There is a better alternative to do this by using Jquery Dialog:
Just put a div in the parent window which will act as the container for the popup contents and check whether it is visible or not.

window.open in web application for iPad running in fullscreen replaces the existing window

I am writing a simple (ASP.NET) web application for the iPad. It is written and works well however one feature is it serving up PDF files (among others). To do this I used window.open to open the file.
When this is done in Safari, it works perfectly. You click the button, the file opens in a new tab; you can then close the tab to return to the previous web page.
However now running the application in fullscreen mode - i.e. with the appropriate "meta names" set and from a shortcut on the home screen - when you click the button to load the file, it loads fullscreen with no means to get back to the last page.
Because it is a file, not a webpage, I can't put a "Back" button on, and when you press the iPad button it simply closes the whole thing.
I know this has been asked before and I have read a number of similar questions - the closest of which was this:
https://stackoverflow.com/questions/9168236/web-app-hyperlinks
If at all possible, it would be far preferable (thanks to the control library I am using) that the button click is done with javascript - it is not easy to set the link href.
The upshot is I really I just want to create a new window from within a fullscreen iPad web application, or allow the "back" navigation somehow...
Is this possible?
Thanks!
Create an iframe on your page rather than using an window.open and set that as the target.
That way your pdf would open within your existing window.
Use some client side javascript like jQuery to style it like a dialog window.

Visual studio debugger still shows old removed pages from iframes

I use modal dialogs. A modal dialog is build up with a mask div, and a container div. The container div contains an iFrame with the modal aspx page. When the modal dialog is initialized, the mask and container are added to the page body. When I close the modal dialog, the mask and container are removed from the body.
Everything works fine, and when I start debugging in Visual Studio, and open a new modal dialog, I see the new page in the debugger at 'script documents - Windows Internet Explorer - somePage.aspx'
But when I close and remove the dialog, the page just stays 'alive' in the VS debugger, until I refresh the complete page.
Is this bad? Does the page 'stay alive' somewhere even tho its removed from the body? Or is it just a Visual Studio debugger UI thingy?
I found this question, about endlessly growing script block files. I think thats the same issue, but that question is not really answered there.
It is not enough to remove the container div that contains the iframe.
I expected that this would be sufficient to remove and destroy the iframe:
$(this.mask).remove();
$(this.container).remove();
The container contains one other div (the modal dialog title) and an iframe.
That iframe is not removed by killing the container using the above code.
It looks like its not just a Visual Studio debugger issue, because the memory of the iexplore.exe process in windows task manager is also going up, and up, and up, every time I close and open a new dialog.
Solution:
When I explicitly remove the iframe, then the page does disapear from the debugger!
I can do that by saving the the iframe in a var on initializing the modal dialog, and then explicity remove the iframe when removing the modal dialog. This way:
on create / initialize modal dialog:
this.frame = this.container.childNodes[0].childNodes[1];
and on close modal dialog:
$(this.frame).remove();

navigateToURL ... set modal property

When a user clicks a button, I need a separate browser window to popup. How can I set the modal property of the application? (ie, when a popup window opens, the main application is disabled until that popup is closed ... I need to use a browser window rather than a popup window, but can't figure out how to disable the main application)
PopUpManager.createPopUp (this, navigateToURL( url, "http://www.google.com" ) , true );
thanks!
[[Updated Answer]]
Ok, my modal dialog looks like so:
cg = mx.managers.PopUpManager.createPopUp(this, ChoiceGrid, true) as ChoiceGrid;
PopUpManager.centerPopUp(cg);
But, what I would do instead of what you're asking, is embed an IFrame in the modal popup. This is exactly what we're doing in our app to collect CC data (well, not the popup part, just the IFrame bit. http://code.google.com/p/flex-iframe/
This way, you have the standard modal dialog you're looking for, AND an internally managed 'view' out to your checkout server. Something like this:
<code:IFrame id="iFrameWithJSfunctions"
src="{checkoutURL}" />
The flex-iframe is pretty easy to work with, for the most part. You shouldn't have many problems with it.
[[Original Answer]]
I'm not sure you need a PopUp to do this.
Why don't you simply do:
navigateToURL(urlRequest,"_blank");
instead?
You should think of a Flex App as a self contained entity. The PopUpManager is designed to create Windows (Panels / any UIComponent) that reside over another component inside the SWF. It does not create items that pop up out of the SWF or in new browser windows.
navigateToURL could be used to create a HTML pop-up from your Flex application. However, there is very little--if any--communication between the SWF and the browser pop up. And there is no way to make a modal pop-up.
You might investigate performing an ExternalInterface call and creating your new pop up in JavaScript. Here is an article about creating modal windows in JavaScript. Before going too far down that road, I would think carefully about your requirements. How would feel if one browser window popped open another browser window and prevented you from doing any browsing until you addressed the issues in that window. Or to put it another way, how would you feel if Microsoft Word opened a word document and wouldn't let you edit any other document until you shut down the first one? I'd be pretty upset.
Modal application dialogs are one thing. And the PopUpManager allows you to create those. I would consider Model application windows a bad UI decision.

How do I open a popup window in ASP.Net with HyperLink control using external javascript file?

Using ASP.Net 2.0
a. On a parent ASPX page, after a HyperLink control is clicked, I need to open a (child) page in a popup window, as modal.
b. Then when that popup window (child page) is closed, I need to get the selections from a datagrid on that popup window and refresh the parent page accordingly.
c. I have open window javascript code in a javascript.js file, which I am loading like this:
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptInclude(this.GetType(), "manualequipentryscript", "javascript.js");
lnkSearchProducts.Attributes.Add("onclick", "LaunchProductSearch();");
}
..isn't working..
How do I implement this?
( I searched the www for the past 2 hours and came up with so many results by haven't been able to get anything concrete that would help me. )
Regards,
Bob
The first thing to understand is that browsers generally do not allow true modal popup windows (with the notable exception of IE). Mozilla based browsers allow you to specify that a window will remain in front, but that cannot be considered modal. This article expands on this actuality.
The usual workaround is to display a Modal dialog in a DIV instead of another window.
Secondly, in order to pass values from a popup window to the parent window, you can either use Javascript methods or server side code. The former method would involve first accessing the parent window (using the window.opener property) and then retrieving references to elements within that parent window. See this article for an example.
The server side method would require you to persist state values and then force a Javascript refresh of the parent window (using window.opener.location.reload();) to enable those values to be loaded.
Finally, the code you have presented seems about right to me. Tell us the error message you get... that may provide a clue.

Resources