D
Drunken Coder
I have a web page with 1 text box, a required field validator a label and a
validation summary. The form is designed so populate the label with text
depending on the state of page.isvalid. However the page will only populate
the label with text if the Page.IsValid but will populate the validation
summary with errors when there is an error. Below is my code. Please someone
point me in the right direction I am starting to pull out my hair over this.
Public Class NewUser
Inherits SDCBase
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents txtUserName As System.Web.UI.WebControls.TextBox
Protected WithEvents btnAccept As System.Web.UI.WebControls.Button
Protected WithEvents lblErrors As System.Web.UI.WebControls.Label
Protected WithEvents reqUserName As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valErrors As
System.Web.UI.WebControls.ValidationSummary
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAccept.Click
If Page.IsValid Then
lblErrors.Text = "There are not errors."
Response.Write(Page.IsValid.ToString)
Else
lblErrors.Text = "Please fix the following errors to continue:"
Response.Write(Page.IsValid.ToString)
End If
End Sub
End Class
validation summary. The form is designed so populate the label with text
depending on the state of page.isvalid. However the page will only populate
the label with text if the Page.IsValid but will populate the validation
summary with errors when there is an error. Below is my code. Please someone
point me in the right direction I am starting to pull out my hair over this.
Public Class NewUser
Inherits SDCBase
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents txtUserName As System.Web.UI.WebControls.TextBox
Protected WithEvents btnAccept As System.Web.UI.WebControls.Button
Protected WithEvents lblErrors As System.Web.UI.WebControls.Label
Protected WithEvents reqUserName As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valErrors As
System.Web.UI.WebControls.ValidationSummary
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAccept.Click
If Page.IsValid Then
lblErrors.Text = "There are not errors."
Response.Write(Page.IsValid.ToString)
Else
lblErrors.Text = "Please fix the following errors to continue:"
Response.Write(Page.IsValid.ToString)
End If
End Sub
End Class