Solved

Reset a Web Page to initial state via Button

Posted on 2003-12-03
8
921 Views
Last Modified: 2012-08-13
Have a web page with 30+ controls of most types(textboxes, dropdown lists, checkboxes...)

User presses a SAVE button (System.Web.UI.WebControls.Button)

From the .net codebehind want to perform various tasks (already written) and then reload / reinitialize the page as if just loaded for the first time.  The actual URL does have some values set ie.  page.aspx?id=1&name=test

Programming in VB.net

Would think this would be easy but have found no simple solution yet...
0
Comment
Question by:dante469
  • 4
  • 2
  • 2
8 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 9869720
Set the viewstate(s) to 'False'. That should do the trick.

D'Mzz!
RoverM
0
 
LVL 7

Author Comment

by:dante469
ID: 9869752
Looking for a modular solution that will work on any web form w/o having to hardcode each control...

Goal is the user hits the SAVE button (record is saved) then form is cleared and user can fill out again and press the SAVE button again...  This process should be repeatable over and over...
0
 
LVL 12

Expert Comment

by:roverm
ID: 9869790
Hmm, how about adding some javascript to reset all values:

<script language="javascript">
  function window.onload()
    { document.forms(0).reset(); }
</script>

D'Mzz!
RoverM
0
 
LVL 7

Author Comment

by:dante469
ID: 9870317
Dim sc As String = "<script language='javascript'> function window.onload() { document.forms(0).reset(); } </script>"

RegisterStartupScript("a", sc)

Does not work :(....
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 18

Accepted Solution

by:
testn earned 250 total points
ID: 9871878
Just do this....

Response.Redirect("page.aspx?id=1&name=test")

:) It should work
0
 
LVL 7

Author Comment

by:dante469
ID: 9874254
testn- Like the approach, however looking for a generic solution and the arguments passed on the command line can/will change.  Soo close :)...
0
 
LVL 7

Author Comment

by:dante469
ID: 9874413
testn- The following code is a generic solution based on your approach:

Response.Redirect(Request.Url.AbsoluteUri, False)

Awarding you the points...  Thank you :)...
0
 
LVL 18

Expert Comment

by:testn
ID: 9879678
Thanks :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now