I have a master page setup with a navigation on the master page, and a few content pages simply called from this navigation. At each content page I have several labels with a link. This links calls another page with a chart (some curves based on the clicked
label). This is done by javascript and window.open(...), which calls a separate aspx page which is pretty stand alone. All parameters are given by the call of the url. That works. Now I tried to modify this, and make it to appear as an iframe on top of the
invoking page. Therefore I have defined a <div..> which I make visibile when called. Inside the div I have a iframe which gets as the src the webpage with the graphs. It works in general, I can see it briefly, but then it disappears. I have no I idea what
happens, it seems that some postback clears it. Can anybody tell me if there is in general something wrong with my approach? I tried the <div> on the content page, as well as on the master page - the result was always the same. Thank you!
So I started a total new project from scratch (the previous one was manually converted from an old frame based version)
With the new simple version I got the same result:
Providing the iframe with a src addr from JScript in the way CuWindow = document.getElementById('ContentPlaceHolder1_GraphWindow'); CuWindow.src ='Test.aspx'; Causes that the "Test.aspx" is displayed very short and then it disappears.
Then i did it from the server with an asp:button in this way: GraphWindow.Attributes("src")
= "Test.aspx" and
now it stays permanent. I assume that the problem is, that after I set the address with JScipt the
src will be overwritten with on from the server - and in my first case this was an empty address. That seems to be the reason why it disappears after a short time.
I
have to admit that I am really confused with properties that I use/set with JScript and from the server.
For exampel the asp:listbox caused a lot of grey hairs to me. When I set the content with JScript, the list box seems to be schizphrenic. The items "added" are different in the same box for the server and for JScript on the client.
Coming
back to my project. On the client I am gathering some selections done by the user in a listbox. The content of this listbox is supplied as parameter to an aspx page, which draws graphs from this.
As above mentioned with the schizoprenic lb I keep the selection also on a server variable in parallel to sync the client with the server.
When
the user on the client fires the call (and there is my problem with the JS src supply and the disappear of the content) I got the effect that the content shows up briefly, and then will be replaced by the server with nothing.
Is
there a way to keep the src setting of JScript and not get it overwritten by the server?
I could try to modify the whole project to be based on server calls.
My problem for this is, that the selection of itemes for the curves is done bey an OnClick event on an asp:label. I do not know if it is possible to catch this click on the server?
Hi Catherine, it is to late. I tiered it down, and redesigned it. Now it is ok. i assume, that after posback the page will be dispoded totally, and so the opened up iframe be JS was gone.
sethach
Member
1 Points
6 Posts
content of iFrame disappears after a few seconds
Dec 23, 2012 05:58 PM|LINK
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: content of iFrame disappears after a few seconds
Dec 23, 2012 07:08 PM|LINK
It sounds much more complicated than it needs to be.
sethach
Member
1 Points
6 Posts
Re: content of iFrame disappears after a few seconds
Dec 23, 2012 08:56 PM|LINK
manjuby
Participant
1131 Points
251 Posts
Re: content of iFrame disappears after a few seconds
Dec 24, 2012 07:00 AM|LINK
Try to use Ispostback and Postback check in your page_load...
if ( !Ispostback)
{
//content to be sent to the page or controls
}
// To post content only when post back occurs use as below
if ( Ispostback)
{
//content to be sent to the page or controls
}
sethach
Member
1 Points
6 Posts
Re: content of iFrame disappears after a few seconds
Dec 24, 2012 11:39 AM|LINK
I tried it, but it did not help.
So I started a total new project from scratch (the previous one was manually converted from an old frame based version)
With the new simple version I got the same result:
Providing the iframe with a src addr from JScript in the way
CuWindow = document.getElementById('ContentPlaceHolder1_GraphWindow');
CuWindow.src ='Test.aspx';
Causes that the "Test.aspx" is displayed very short and then it disappears.
Then i did it from the server with an asp:button in this way:
GraphWindow.Attributes("src") = "Test.aspx"
and now it stays permanent. I assume that the problem is, that after I set the address with JScipt the
src will be overwritten with on from the server - and in my first case this was an empty address. That seems to be the reason why it disappears after a short time.
I have to admit that I am really confused with properties that I use/set with JScript and from the server.
For exampel the asp:listbox caused a lot of grey hairs to me. When I set the content with JScript, the list box seems to be schizphrenic. The items "added" are different in the same box for the server and for JScript on the client.
Coming back to my project. On the client I am gathering some selections done by the user in a listbox. The content of this listbox is supplied as parameter to an aspx page, which draws graphs from this.
As above mentioned with the schizoprenic lb I keep the selection also on a server variable in parallel to sync the client with the server.
When the user on the client fires the call (and there is my problem with the JS src supply and the disappear of the content) I got the effect that the content shows up briefly, and then will be replaced by the server with nothing.
Is there a way to keep the src setting of JScript and not get it overwritten by the server?
I could try to modify the whole project to be based on server calls.
My problem for this is, that the selection of itemes for the curves is done bey an OnClick event on an asp:label. I do not know if it is possible to catch this click on the server?
Thanks
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: content of iFrame disappears after a few seconds
Dec 26, 2012 06:30 AM|LINK
Hi,
In order to resolve your issue, please try to upload your project to skydrive and provide the link. I want to test locally and try to find the issue.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
sethach
Member
1 Points
6 Posts
Re: content of iFrame disappears after a few seconds
Dec 28, 2012 08:37 PM|LINK