Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
ASP.NET
Web Forms
costum validator problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="RTT" data-source="post: 6401" data-attributes="member: 2333"><p>It's my first time i want to write a cotum validator but it doesn't seem to</p><p>work. In de page i've put this validator:</p><p><asp:CustomValidator id="CVFBeginDate"</p><p>OnServerValidate="CVFBeginDate_ServerValidate" runat="server"</p><p>ErrorMessage="Please fill in a valid date as startdate"</p><p>ControlToValidate="TxtBeginDate">*</asp:CustomValidator></p><p></p><p>in de codebehindpage i have created this sub:</p><p> Protected Sub CVFBeginDate_ServerValidate(ByVal source As System.Object,</p><p>ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles</p><p>CVFBeginDate.ServerValidate</p><p> Try</p><p> tmp = args.Value.Split("/")</p><p> testDate = New Date(tmp(2).ToString(), tmp(1).ToString(),</p><p>tmp(0).ToString())</p><p> args.IsValid = True</p><p> Catch</p><p> args.IsValid = False</p><p> End Try</p><p> End Sub</p><p></p><p></p><p>it doesn't seem to work. do you have to put something special to the custom</p><p>validator?</p></blockquote><p></p>
[QUOTE="RTT, post: 6401, member: 2333"] It's my first time i want to write a cotum validator but it doesn't seem to work. In de page i've put this validator: <asp:CustomValidator id="CVFBeginDate" OnServerValidate="CVFBeginDate_ServerValidate" runat="server" ErrorMessage="Please fill in a valid date as startdate" ControlToValidate="TxtBeginDate">*</asp:CustomValidator> in de codebehindpage i have created this sub: Protected Sub CVFBeginDate_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CVFBeginDate.ServerValidate Try tmp = args.Value.Split("/") testDate = New Date(tmp(2).ToString(), tmp(1).ToString(), tmp(0).ToString()) args.IsValid = True Catch args.IsValid = False End Try End Sub it doesn't seem to work. do you have to put something special to the custom validator? [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
ASP.NET
Web Forms
costum validator problem
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom