G
Guest
I've been looking and trying suggestions from here and elsewhere, but I can't
seem to make them work. I'm using VisualStudio.net Development Environment
7.0.9466.
I am trying to duplicate the functionality of a straight html page that I
was given as a mock up.
I have a web form with several textbox input fields and one checkbox. I have
added simple requiredfieldvalidators after the textbox inputs, and a submit
button that seems to correctly display the error message when the text fields
are not filled in.
I want to be able to add a reset button as well.
I added a button control, similar to the way I did the submit button, but
made causesValidation false.
I double clicked on the button in the design environment which brought me to
the code behind and the _Click event for the button.
However, when I run the project, either through viewing the page in a
browser or the Solution start button on the toolbar, the new button seems
dead.
As I said, the Submit button I placed in a similar way seems to work fine.
I've tried (after adding an "id" value of form1 to the default form that was
generated by creating the page):
Dim myForm As Control = Page.FindControl("form1")
Dim ctl As Control
For Each ctl In myForm.Controls
If
ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox") Then
CType(ctl, TextBox).Text = ""
End If
Next ctl
and also tried explicitly setting the fields, for example:
UserName.Text = ""
where UserName is one of the textbox controls.
I placed a breakpoint on
Private Sub ResetButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ResetButton1.Click
before running it in debug mode, but it didn't seem to ever hit it.
(I'm just developing on localhost)
I also tried, as an experiment
UserName.font.bold = not UserName.font.bold
and msgbox("test")
to see if I could at least get anything out of the button.
I know it was added to the class
Protected WithEvents ResetButton1 As System.Web.UI.WebControls.Button
If I change the causeValidation to true it validates.
It's probably something obvious, but I'm stumped at the moment.
Any help appreciated.
Keith
seem to make them work. I'm using VisualStudio.net Development Environment
7.0.9466.
I am trying to duplicate the functionality of a straight html page that I
was given as a mock up.
I have a web form with several textbox input fields and one checkbox. I have
added simple requiredfieldvalidators after the textbox inputs, and a submit
button that seems to correctly display the error message when the text fields
are not filled in.
I want to be able to add a reset button as well.
I added a button control, similar to the way I did the submit button, but
made causesValidation false.
I double clicked on the button in the design environment which brought me to
the code behind and the _Click event for the button.
However, when I run the project, either through viewing the page in a
browser or the Solution start button on the toolbar, the new button seems
dead.
As I said, the Submit button I placed in a similar way seems to work fine.
I've tried (after adding an "id" value of form1 to the default form that was
generated by creating the page):
Dim myForm As Control = Page.FindControl("form1")
Dim ctl As Control
For Each ctl In myForm.Controls
If
ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox") Then
CType(ctl, TextBox).Text = ""
End If
Next ctl
and also tried explicitly setting the fields, for example:
UserName.Text = ""
where UserName is one of the textbox controls.
I placed a breakpoint on
Private Sub ResetButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ResetButton1.Click
before running it in debug mode, but it didn't seem to ever hit it.
(I'm just developing on localhost)
I also tried, as an experiment
UserName.font.bold = not UserName.font.bold
and msgbox("test")
to see if I could at least get anything out of the button.
I know it was added to the class
Protected WithEvents ResetButton1 As System.Web.UI.WebControls.Button
If I change the causeValidation to true it validates.
It's probably something obvious, but I'm stumped at the moment.
Any help appreciated.
Keith