473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 10960
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 Cancel buttons on a Windows form. However, I...
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 'back' button doesn't work and had always assumed...
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 controls are not visible, i.e. not showing an error...
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 moved from the framework 1.0 to 1.1 and it doesn't...
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 have an <asp:button runat="server"> in the test...
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 in the bottom of the screen so I can edit the...
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 certain page refresh every five minutes. I was told...
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 rebooted and it still fails. Any idea how to fix...
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" src="../images/Remove.jpg" type="image" /> if(isset($_POST)){...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.