Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reset a Web Page to initial state via Button

Posted on 2003-12-03
8
Medium Priority
?
930 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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