CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 11/18/2003 7:29:06 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 26 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
theangrycoder
Asp.Net User
Cutsom Validator Problem.11/18/2003 7:29:06 PM

0/0

Hi,

I was creating a custom validator control to validate email box. I created that successfully, But only one problem. That is, it was supposed to validate on client side, but it is going to server and then displays error message. Is there anyone who can help me that where am I wrong? Here is the complete code of my class.


Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Collections
Imports System.Text.RegularExpressions

Namespace stiLLangrY
Public Class ValidateEMail
Inherits System.Web.UI.WebControls.BaseValidator

Private _textBox As System.Web.UI.WebControls.TextBox

'Constructor
Public Sub New()
MyBase.New()
MyBase.IsValid = True
End Sub

'custom function to validate. Note just sample text is here. Original functionality is to written.
Private Function isValidEMail(ByVal text As String) As Boolean
If text = "sameers" Then
MyBase.IsValid = True
Return True
Else
MyBase.ErrorMessage = "DEMO: Invalid EMail address"
MyBase.IsValid = False
Return False
End If
End Function
'Overwridden function. On validation, this function is called. Return true if text is valid, else false.
Protected Overrides Function EvaluateIsValid() As Boolean
Return isValidEMail(_textBox.Text)

End Function

'Overwridden function to validate if right control was specified to validate
Protected Overrides Function ControlPropertiesValid() As Boolean
Dim ctrl As Control = FindControl(MyBase.ControlToValidate)

If ctrl Is Nothing Then
Return False
Else
If TypeOf ctrl Is System.Web.UI.WebControls.TextBox Then
'Yes, it is textbox control
_textBox = CType(ctrl, System.Web.UI.WebControls.TextBox)
Return Not (_textBox Is Nothing)
Else
'No, It's not a textbox control
Return False
End If
End If
End Function
End Namespace


Repeating again, this control is working fine, but it goes to server (post back) and then displays error. I don't want to let it go on server instead, as regular controls displays messages before posting form back to server.

Thanks,

Sameers
Sameers (theangrycodeR)
http://www.theangrycoder.com/IamAway.aspx
PLBlum
Asp.Net User
Re: Cutsom Validator Problem.11/19/2003 4:22:52 AM

0/0

Hi Sameers,

Custom Validators require you to write the JavaScript that is used on the client side and export it out within your validator code, usually using the Page.RegisterClientScriptBlock method. See the .Net topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolscustomvalidatorclasstopic.asp

There is an easier way. Use a RegularExpressionValidator. It provides both client and server side. You only need to find a regular expression pattern for email addresses. Here's one I've used:
^([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)

Don't forget that all validators work on IE on the client side but don't support other browsers. If you need to support other browsers, check out Professional Validation And More.
--- Peter Blum
Creator of Professional Validation And More Suite, Peter's Date Package, and Peter's Polling Package
www.PeterBlum.com
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Jakarta Struts Cookbook Authors: Bill Siggelkow, Pages: 507, Published: 2005
Mastering Web Development with Microsoft Visual Studio 2005 Authors: John Paul Mueller, Pages: 822, Published: 2005
Pro .NET 2.0 Windows Forms and Custom Controls in C#: From Professional to Expert Authors: Matthew MacDonald, Pages: 1037, Published: 2005
Pro WF: Windows Workflow in .NET 3.0 Authors: Bruce Bukovics, Pages: 709, Published: 2007
Mastering JavaServer Faces Authors: Bill Dudney, Jonathan Lehr, Bill Willis, LeRoy Mattingly, Pages: 456, Published: 2004
The Definitive Guide to Django: Web Development Done Right Authors: Adrian Holovaty, Jacob Kaplan-Moss, Pages: 447, Published: 2007
Pro ASP.NET 2.0 in VB 2005: special edition. Authors: Laurence Moroney, Matthew MacDonald, Pages: 1360, Published: 2006
Pro JSP 2 Authors: Simon Brown, Sam Dalton, Daniel Jepp, Kevin Mukhar, Dave Johnson, Sing Li, Matt Raible, Pages: 728, Published: 2005
Struts: The Complete Reference Authors: James Holmes, Pages: 800, Published: 2006
Java Servlet and JSP Cookbook: Practical Solutions to Real-world Problems Authors: Bruce W. Perry, Pages: 723, Published: 2004

Web:
custom validator - problem returning bit/boolean in DAL - ASP.NET ... custom validator - problem returning bit/boolean in DAL. Last post 10-07-2008 4: 25 PM by NuJoizey. 8 replies. Sort Posts: ...
Re: Archetype custom validator problem: msg#00033 Previous by Date: Archetype custom validator problem, Ingo Paenke. Next by Date: Simple class change script?, Wolfgang Müller ...
Custom Validator not working without RequiredValidator I have written a custom validator function to validate a datefrom a user-filled field. ... The problem is that this doesn't work - although ...
Microsoft: ASP.NET - custom validator - problem returning bit ... The problem is no matter what I do, objResult always is returning false and I can't figure out why. In my XSD file, the qta. ...
Javascript custom validator problem on DropDownList - JavaScript Javascript custom validator problem on DropDownList. Get answers to your questions in our JavaScript forum.
Custom Validator Problem - WebDeveloper.com Custom Validator Problem .NET. ... Im trying to use the Custom Validator and it does not seem to be hitting the server side sub for the ...
Custom Validation Summary Problem 3) In the server-side custom validation code, you have to set three ... Problem with asp menu (background image of MenuItem) ...
Custom Validator problem - ASP.NET Forums Custom Validator problem. Last post 09-20-2008 12:41 AM by superconsultant. 10 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
custom validator problem Talk about custom validator problem. ... Posts: n/a. Default Re: custom validator problem - and how should it work? ...
Struts Validator Framework: problem with Custom Validator Jun 24, 2008 ... View this message in context: http://www.nabble.com/Struts-Validator-Framework% 3A-problem-with-Custom-Validator-tp18098053p18098053.html ...

Videos:
You Tubers Love Excel#6: VLOOKUP and Custom Data Validation See when the IF function is not efficient to use. Instead we will use the VLOOKUP function and a logical True/False Data Validation formula to calcul...
Providing Custom Intellisense and schema driven validation This video is a screencast from Channel9.msdn.com showing how to provide custom schema for validation and intellisense in VS2005 IDE.
Learning ColdFusion Chapter 9 - Custom Form Validation In this video, we will learn how to make our own custom ColdFusion code for custom form validation. Download Exercise Files: http://www.filedropper....
YTLE#84: A Few Data Validation Tricks See how to use Custom True/False formulas for Data Validation and how to add an Error message. Also see the built in Text Length Feature.
Custom Data Validation in Microsoft Excel You can use custom data validation in Excel to prevent errors during data entry.
Microsoft Excel 2000 Volume IV Training and Help Advanced Data Analysis - Introduction to Excel 2000 Volume IV - Introduction to Segment 1 - Retrieving a Workbook - Using Goal Seek - Using Solver - ...
Drupal Ajax Form Validation and Submission This is a custom module made for Drupal 5. If $form['ajaxform'] is set to true a form alter is done to setup the form for Ajax submission. The jQue...
WebWork Presentation Patrick Lightbody BayCHI JAVAWUG (Part 2) Whilst I was in San Francisco, California, attending JavaONE 2006 I saw a valuable presentation on Monday 15th June 2006. With the gracious help of D...
Microsoft Excel 2000 Volume IV Training and Help Advanced Data Analysis - Introduction to Excel 2000 Volume IV - Introduction to Segment 1 - Retrieving a Workbook - Using Goal Seek - Using Solver - ...
YTL Excel #126: VLOOKUP & INDIRECT & COLUMN functions See how to retrieve values from more than one table. See how to populate a template with values using Data Validation, VLOOKUP, INDIRECT, COLUMN, and...




Search This Site:










running total in text boxes

compare and insert into dropdownlist

error - name '....' is not declared. please help

filling controls and reloading page

open a page from code behind

validating drop down list selection

tutorial: inbetween tables

varybyparam

radio button event not getting fired

calling cognos reportnet from asp.net

web control (listibox)

show a scrollbar on asp.net page

linkbutton doesn't work in cached user control

replace text in labels and controls

only after first click all works fine

email attachment problem

system.web.mail stripping accents

clientclick only button?

change label text

how to append id to sitemap?

make a page run as a specific user instead of who is logged in

how do i start a desktop application from a web page? ideas?

please some softwares that can design my tabs & buttons

adding controls within treeview control

custom display value in a databound drop down

firing an event in dropdown list

could not load type 'confsys.global'

usercontrol talking to its hosting aspx

no overload for method error

set listbox property form another webpage

  Privacy | Contact Us
All Times Are GMT