keyongtech


  keyongtech > dotnet.framework.aspnet.* > dotnet.framework.aspnet.main > 11/2003

 #1  
11-17-03, 06:39 PM
Chris Lane
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
 #2  
11-17-03, 06:45 PM
Chris Bower
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" <rckrll4ever> wrote in message
news:280a
[..]
 #3  
11-17-03, 06:53 PM
Chris Lane
Thank You.
>-----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
[..]
 #4  
11-17-03, 07:51 PM
Chris Lane
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
[..]
 #5  
11-17-03, 11:52 PM
Chris Lane
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.
[..]
Similar Threads
Submit button doesn't work, neither does the confirmation page!

Hello everyone, I am new to this forum and would very much appreciate everyone's advice on my problem(s). I have created a form, located here ([..]) though I cannot figure...

submit button to e-mail address doesn't work

Hi, I have a form with a submit button that sends an email to an smtp address. The server extensions are loaded and have been configured for email and the form used to work...

Changing a HTML submit button that requests a Servlet, to an image button? How?

I have an HTML page that has a form with submit button, that when pressed, performs an action upon a Java Servlet and fetches back a relevant...

Submit Button doesn't work?

I created several fill-in forms for my web page. Half of them work fine, they submit the filled in data via Outlook email. The other half don't work. When I right click on...

Submit button doesn't work

I've made a short form on word which I want to put on my website to be filled out and sent to my email. But I can't figure out how to use the submit button-- I thought I...


All times are GMT. The time now is 07:40 AM. | Privacy Policy