By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,514 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.