Discussion:
Clearing a web form
(too old to reply)
John Clennett
2006-01-27 14:52:02 UTC
Permalink
I have an 'Awards' form that can be accessed by 2 different methods,
1 - Via a customer details form that has a button on it to enable the user
to re-direct to the 'Awards' form passing it the customerID & name so that
the new form can be automatically populated with the selected customer
details. I store the customerID & name in session variables for the Awards
form to read.
2 - Via the main menu form to display a blank 'Awards' form for manual input.

When the user has finished with the 'Awards' form they are returned to the
main menu.

The problem I'm having is that despite clearing all the text fields in the
'Awards' form & clearing the Session variables before exiting, when I next go
into the form it has retained, & displays the previous customerID & name
instead of a blank form.

Has anyone any ideas how to overcome this?

Thanks,
John
Mehfuz Hossain
2006-01-28 07:46:51 UTC
Permalink
looks like you have multiple problem.now this can be possible , when
the sesion is not cleared properly.. . Did you do the
Session.Abandon(); , or did you checked the Customer deatils load mehod
( whether it is loading a default customer or not),or the link you are
redirecting still holding a customer Id.

Follow these steps to find your problem
----------------------------------------------------------
1. Revise you customer load method.
2. Check if the session cleared and abandonded properly.
3. check the url you are navigating to, is this dynamically built and
holds a default customer from database?
4.Is the viewstate of the controls are set to false.

Best Regards,
Mehfuz Hossain.
http://www.mehfuz.com
John Clennett
2006-01-31 12:01:17 UTC
Permalink
Thanks Mehfuz I've tried you suggestions but to no avail I'm afraid.

Looking into it further I seem to of pinned the problem down to the Menu
User Control I'm using.
When you select from the menu dropdown list in debug, it appears the
Page_Load event in the Awards form isn't being triggered & it's here it
checks the Session variables to see if there are values to populate the Form.
It's almost like it's held the form in memory & just re-displaying it.
Putting an extra button on the Menu form for testing, & opening the Awards
page from there all works fine.

Any further ideas on what may be causing this?

Thanks,

John
Post by Mehfuz Hossain
looks like you have multiple problem.now this can be possible , when
the sesion is not cleared properly.. . Did you do the
Session.Abandon(); , or did you checked the Customer deatils load mehod
( whether it is loading a default customer or not),or the link you are
redirecting still holding a customer Id.
Follow these steps to find your problem
----------------------------------------------------------
1. Revise you customer load method.
2. Check if the session cleared and abandonded properly.
3. check the url you are navigating to, is this dynamically built and
holds a default customer from database?
4.Is the viewstate of the controls are set to false.
Best Regards,
Mehfuz Hossain.
http://www.mehfuz.com
Eric Giles
2006-02-01 13:31:25 UTC
Permalink
Do you need to use the Session object to retain these values? Have you
considered using a server-side transfer and then accessing server-side
property values via the context?

Have a look at the following article.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp

The other thing you could do would be to explicitly set the Session object
values to nothing - empty strings etc. from the menu page prior to
redirecting the user to the awards page.

HTH.
Post by John Clennett
Thanks Mehfuz I've tried you suggestions but to no avail I'm afraid.
Looking into it further I seem to of pinned the problem down to the Menu
User Control I'm using.
When you select from the menu dropdown list in debug, it appears the
Page_Load event in the Awards form isn't being triggered & it's here it
checks the Session variables to see if there are values to populate the Form.
It's almost like it's held the form in memory & just re-displaying it.
Putting an extra button on the Menu form for testing, & opening the Awards
page from there all works fine.
Any further ideas on what may be causing this?
Thanks,
John
Post by Mehfuz Hossain
looks like you have multiple problem.now this can be possible , when
the sesion is not cleared properly.. . Did you do the
Session.Abandon(); , or did you checked the Customer deatils load mehod
( whether it is loading a default customer or not),or the link you are
redirecting still holding a customer Id.
Follow these steps to find your problem
----------------------------------------------------------
1. Revise you customer load method.
2. Check if the session cleared and abandonded properly.
3. check the url you are navigating to, is this dynamically built and
holds a default customer from database?
4.Is the viewstate of the controls are set to false.
Best Regards,
Mehfuz Hossain.
http://www.mehfuz.com
John Clennett
2006-02-01 14:41:30 UTC
Permalink
I have tried setting the values to null in the Menu form but the problem is,
it appears the Load event isn't being triggered when going back into the
Award form & therefore not running the code to clear the form.
Looking at the article you suggested & using Server.Transfer I have the same
problem in the Load event not being triggered.
Stepping through in debug when the Award form is first opend from the menu
form the load event code is run but after that it isn't, it's as if the Award
form hasn't been closed & is just re-displayed with the original data.
Post by Eric Giles
Do you need to use the Session object to retain these values? Have you
considered using a server-side transfer and then accessing server-side
property values via the context?
Have a look at the following article.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp
The other thing you could do would be to explicitly set the Session object
values to nothing - empty strings etc. from the menu page prior to
redirecting the user to the awards page.
HTH.
Post by John Clennett
Thanks Mehfuz I've tried you suggestions but to no avail I'm afraid.
Looking into it further I seem to of pinned the problem down to the Menu
User Control I'm using.
When you select from the menu dropdown list in debug, it appears the
Page_Load event in the Awards form isn't being triggered & it's here it
checks the Session variables to see if there are values to populate the Form.
It's almost like it's held the form in memory & just re-displaying it.
Putting an extra button on the Menu form for testing, & opening the Awards
page from there all works fine.
Any further ideas on what may be causing this?
Thanks,
John
Post by Mehfuz Hossain
looks like you have multiple problem.now this can be possible , when
the sesion is not cleared properly.. . Did you do the
Session.Abandon(); , or did you checked the Customer deatils load mehod
( whether it is loading a default customer or not),or the link you are
redirecting still holding a customer Id.
Follow these steps to find your problem
----------------------------------------------------------
1. Revise you customer load method.
2. Check if the session cleared and abandonded properly.
3. check the url you are navigating to, is this dynamically built and
holds a default customer from database?
4.Is the viewstate of the controls are set to false.
Best Regards,
Mehfuz Hossain.
http://www.mehfuz.com
Shaguf
2010-04-05 11:50:28 UTC
Permalink
Hi,
Saltmarch is organizing Great Indian Developer Summit 2010 in Bangalore from April 2010 to 23 April High qualified International Speakers, Speakers from Microsoft like Venkat Subramaniam, Simone Brunozzi, Stephen Forte etc are going to speak at this conference. This Conference will be based on topics like .Net, Java and Richweb. Interested people can register at developersummit dot com

From http://www.developmentnow.com/g/54_2006_1_0_0_685307/Clearing-a-web-form.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Loading...