Solved

Reset a Web Page to initial state via Button

Posted on 2003-12-03
8
929 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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
 
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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

622 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