One simple question on Page Refreshing
-
Hi all the lovely people out there, I am just a beginner in Asp.net. I have a page which has a login link. When i click the login link it pops up a small window where he can login. But after successful login I do not know how to refresh the original page and change the login label to logout. Can you guys help me out?
-
Hi all the lovely people out there, I am just a beginner in Asp.net. I have a page which has a login link. When i click the login link it pops up a small window where he can login. But after successful login I do not know how to refresh the original page and change the login label to logout. Can you guys help me out?
-
-
xbiplav wrote:
Also, can AJAX capable of doing such stuffs.
No, of course not. Not without doing it in a convoluted and wasteful way. AJAX lets a page ask the server for data without doing a full refresh. You'd have to have both pages polling with AJAX to find out if the event had occured. That would be a total waste of time. Just because something is sexy for the moment in the dev world, does not mean you should invent ways to use it when it's the wrong tool for the job. The ASP.NET AJAX library DOES do some stuff that has NOTHING to do with AJAX, so it may have something that will help you, but only because it's become the home of any sort of javascript coolness that MS can come up with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
xbiplav wrote:
Also, can AJAX capable of doing such stuffs.
No, of course not. Not without doing it in a convoluted and wasteful way. AJAX lets a page ask the server for data without doing a full refresh. You'd have to have both pages polling with AJAX to find out if the event had occured. That would be a total waste of time. Just because something is sexy for the moment in the dev world, does not mean you should invent ways to use it when it's the wrong tool for the job. The ASP.NET AJAX library DOES do some stuff that has NOTHING to do with AJAX, so it may have something that will help you, but only because it's become the home of any sort of javascript coolness that MS can come up with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Thank you once again. Also i want to ask you one last thing and I am sorry for my ignorance. My question is that, like in windows programming we can change the state of Form1 from Form2 by creating objects and passing messages. Similarly like in web, is it possible like we create an object of WebForm1, then pass this instance to WebForm2 and if we want to change an object's state of WebForm1(lets say a label text in WebForm1 to something) can we use that instance of Webform1 (from Webform2) and do that?
-
Thank you once again. Also i want to ask you one last thing and I am sorry for my ignorance. My question is that, like in windows programming we can change the state of Form1 from Form2 by creating objects and passing messages. Similarly like in web, is it possible like we create an object of WebForm1, then pass this instance to WebForm2 and if we want to change an object's state of WebForm1(lets say a label text in WebForm1 to something) can we use that instance of Webform1 (from Webform2) and do that?
No, you can't. The web is stateless. Every postback creates a new instance of that page class, which is then destroyed when the page is sent. webform1 does NOT exist if it's not visible. There's nothing to interact with. You pass values between pages by putting them on the URL or storing them in the session. The URL way is far better, it creates pages that rebuild themselves and can be bookmarked, and does not use server resources. Sometimes, you do need to use the session tho.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
No, you can't. The web is stateless. Every postback creates a new instance of that page class, which is then destroyed when the page is sent. webform1 does NOT exist if it's not visible. There's nothing to interact with. You pass values between pages by putting them on the URL or storing them in the session. The URL way is far better, it creates pages that rebuild themselves and can be bookmarked, and does not use server resources. Sometimes, you do need to use the session tho.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Glad to help :-) It's customary if the answers helped to mark them with the 'good answer' button or the '5'.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Glad to help :-) It's customary if the answers helped to mark them with the 'good answer' button or the '5'.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi all the lovely people out there, I am just a beginner in Asp.net. I have a page which has a login link. When i click the login link it pops up a small window where he can login. But after successful login I do not know how to refresh the original page and change the login label to logout. Can you guys help me out?
When ever you open a pop window , you can get the reference of the parent. Once the login is successful, you cna pass a success indicator to the parent. In the function where you might have called the pop up window, check for this indicator and then check the Text to Log Out at the client side using javascript.
-
When ever you open a pop window , you can get the reference of the parent. Once the login is successful, you cna pass a success indicator to the parent. In the function where you might have called the pop up window, check for this indicator and then check the Text to Log Out at the client side using javascript.