dante469
asked on
Reset a Web Page to initial state via Button
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...
User presses a SAVE button (System.Web.UI.WebControls
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...
ASKER
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...
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...
Hmm, how about adding some javascript to reset all values:
<script language="javascript">
function window.onload()
{ document.forms(0).reset(); }
</script>
D'Mzz!
RoverM
<script language="javascript">
function window.onload()
{ document.forms(0).reset();
</script>
D'Mzz!
RoverM
ASKER
Dim sc As String = "<script language='javascript'> function window.onload() { document.forms(0).reset(); } </script>"
RegisterStartupScript("a", sc)
Does not work :(....
RegisterStartupScript("a",
Does not work :(....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
testn- Like the approach, however looking for a generic solution and the arguments passed on the command line can/will change. Soo close :)...
ASKER
testn- The following code is a generic solution based on your approach:
Response.Redirect(Request. Url.Absolu teUri, False)
Awarding you the points... Thank you :)...
Response.Redirect(Request.
Awarding you the points... Thank you :)...
Thanks :)
D'Mzz!
RoverM