473,573 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10978
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*********@ya hoo.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*********@ya hoo.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_Server Click(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
btnReset.Server Click
txtStoreName.Va lue = ""
txtCity.Value = ""
txtPostalCode.V alue = ""
txtStreet.Value = ""
txtPhone.Value = ""
txtAreaCode.Val ue = ""
End Sub
I stepped thru this in debug mode and the
btnReset.Server Click 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*********@ya hoo.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_Server Click(ByVal sender As
System.Objec t, ByVal e As System.EventArg s) Handles
btnReset.Serve rClick
txtStoreName.Va lue = ""
txtCity.Value = ""
txtPostalCode.V alue = ""
txtStreet.Value = ""
txtPhone.Value = ""
txtAreaCode.Val ue = ""
End Sub
I stepped thru this in debug mode and the
btnReset.Serve rClick 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*********@ya hoo.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
1528
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 deleted them and then created two Image Buttons with the same names. Now, the IDE will acknowledge that it sees them when I try to set the...
3
2724
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 this was done w/JavaScript.. so was asked for an example.. so now found an example.. here's a site where 'back' button doesn't work.....
4
1439
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 with the control they are validating). When I click the buttons they enter the depressed state, but nothing happens. Similar button controls...
4
3396
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 work only on IE! My ASPX page works in FireFox. If the button doesn't work it's because of validators (and it worked with the same code in v1.0).
7
3667
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 version of my app that is essentially a backdoor for changing the class of user inside the application on the fly....it has a textbox next to it you...
2
1453
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 layout. For some reason, the "Design" button doesn't work and I can't access the screen layout !!! Besides: the Enter, Backspace and Delete buttons...
9
4428
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 to use <META HTTP-EQUIV="Refresh" CONTENT="300"> and place it inside the HEAD tags. Well this doesn't work because when I click on the link to go to...
0
1053
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 it? It happened all of a sudden...
7
3688
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)){ echo "remove"; }
0
7767
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7768
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8058
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6400
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5579
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5288
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2191
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1295
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1035
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.