472,348 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

HTML Reset Button Doesn't work after postback with Submit button

Hi,

I have an HTML RESET button and Web Control Button that
posts back to the server. Problem is the reset button
doesn't work after the postback occurs. Any ideas or
suggestions as to why this happens or how I can work
around this?

Thanks
Nov 18 '05 #1
4 10811
It doesn't work because HTML Reset buttons reset the controls in a form back
to the value they were when the page first loaded. When you post back, the
ASP.NET engine sets the values of the controls again, so the Reset would do
nothing more than change the controls back to what they were when you loaded
the page after the postback.

The only solution to this is to either do it client-side with javascript or
server-side on a postback. Just iterate through all of your controls and set
their properties appropriately.
"Chris Lane" <rc*********@yahoo.com> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an HTML RESET button and Web Control Button that
posts back to the server. Problem is the reset button
doesn't work after the postback occurs. Any ideas or
suggestions as to why this happens or how I can work
around this?

Thanks

Nov 18 '05 #2
Thank You.
-----Original Message-----
It doesn't work because HTML Reset buttons reset the controls in a form backto the value they were when the page first loaded. When you post back, theASP.NET engine sets the values of the controls again, so the Reset would donothing more than change the controls back to what they were when you loadedthe page after the postback.

The only solution to this is to either do it client-side with javascript orserver-side on a postback. Just iterate through all of your controls and settheir properties appropriately.
"Chris Lane" <rc*********@yahoo.com> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an HTML RESET button and Web Control Button that
posts back to the server. Problem is the reset button
doesn't work after the postback occurs. Any ideas or
suggestions as to why this happens or how I can work
around this?

Thanks

.

Nov 18 '05 #3
OK I made the HTML RESET Button an HTML Server Control.
I then added the following code:
Private Sub btnReset_ServerClick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnReset.ServerClick
txtStoreName.Value = ""
txtCity.Value = ""
txtPostalCode.Value = ""
txtStreet.Value = ""
txtPhone.Value = ""
txtAreaCode.Value = ""
End Sub
I stepped thru this in debug mode and the
btnReset.ServerClick method does not fire.
I will try it with a web control button and see if that
works.
Any suggestions or ideas?
-----Original Message-----
It doesn't work because HTML Reset buttons reset the controls in a form backto the value they were when the page first loaded. When you post back, theASP.NET engine sets the values of the controls again, so the Reset would donothing more than change the controls back to what they were when you loadedthe page after the postback.

The only solution to this is to either do it client-side with javascript orserver-side on a postback. Just iterate through all of your controls and settheir properties appropriately.
"Chris Lane" <rc*********@yahoo.com> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an HTML RESET button and Web Control Button that
posts back to the server. Problem is the reset button
doesn't work after the postback occurs. Any ideas or
suggestions as to why this happens or how I can work
around this?

Thanks

.

Nov 18 '05 #4
Ok I figured out what I did wrong.
I forgot to change the HTML Property Type = reset to
Type = button.
Now the serverside click event occurs for the HTML Server
Control.
Again Thank You for your help.
-----Original Message-----
OK I made the HTML RESET Button an HTML Server Control.
I then added the following code:
Private Sub btnReset_ServerClick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnReset.ServerClick
txtStoreName.Value = ""
txtCity.Value = ""
txtPostalCode.Value = ""
txtStreet.Value = ""
txtPhone.Value = ""
txtAreaCode.Value = ""
End Sub
I stepped thru this in debug mode and the
btnReset.ServerClick method does not fire.
I will try it with a web control button and see if that
works.
Any suggestions or ideas?
-----Original Message-----
It doesn't work because HTML Reset buttons reset the

controls in a form back
to the value they were when the page first loaded. When

you post back, the
ASP.NET engine sets the values of the controls again, so

the Reset would do
nothing more than change the controls back to what they

were when you loaded
the page after the postback.

The only solution to this is to either do it client-side

with javascript or
server-side on a postback. Just iterate through all of

your controls and set
their properties appropriately.
"Chris Lane" <rc*********@yahoo.com> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an HTML RESET button and Web Control Button that
posts back to the server. Problem is the reset button
doesn't work after the postback occurs. Any ideas or
suggestions as to why this happens or how I can work
around this?

Thanks

.

.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Ryan | last post by:
I have two Image Buttons btnOk, btnCancel which used to just be regular forms buttons. They worked fine when I set them as the default Accept and...
3
by: Frances Del Rio | last post by:
the other day someone asked can u disable 'back' button w/JavaScript.. response was NO.. I asked really? because I've seen a lot of sites where...
4
by: Spence Hackney | last post by:
I have noticed that within my application my button controls do not work when there are validation controls on the panel (even if the validation...
4
by: bbp | last post by:
Hello, In an ASPX page I have a "Quit" button which make a simple redirect in code-behind. This button doesn't work no more since (I think) I...
7
by: CharlesA | last post by:
Hi folks, first off, I'm using .Net framework 1.1 with ASP.net and C# I'm trying to do something very simple...but I can't figure it out I...
2
by: ruthiefy | last post by:
Hi, I am new to ASP.NET and I started working with 2005. I opened a new project and in the Default.aspx Web Form I clicked the "Design" button...
9
by: Shalako | last post by:
I have several web pages that are perl files with .pl extensions. Inside these I have HTML code for the web page display. I am trying to have a...
0
by: Bobby Edward | last post by:
All of a sudden my "Browse..." button doesn't work anymore. This is the button in the CSS "Modify Style" dialog for "background-image:". I've...
7
by: ghjk | last post by:
I have a image button in php. But it doesn't work. This is my code <form method="post" action="user.php"> <input name="Remove"...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.