Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

hooking into the validation summary control, adding a custom error     message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DotNetNewbie - 03 Mar 2008 18:46 GMT
Hello,
I have a validation summary tag in my .aspx page, and when a user
clicks on a submit button I check the database for a duplicate
username that the user entered into a textbox control.

If I find a duplicate username in the database, I want to insert a
message into the validationsummary control like "username already
exists, please enter a different username".

How can I do this?
Jesse Houwing - 03 Mar 2008 22:36 GMT
Hello DotNetNewbie,

> Hello,
> I have a validation summary tag in my .aspx page, and when a user
[quoted text clipped - 5 lines]
>
> How can I do this?

Add a CustomValidator control to your page. Set the error message and text
property as you would do with any other validator. Now go to the events tab
and implement the ServerValidate event to go to the database. you need to
set the eventargs.valid property to false to show the error.

It resets automatically each post, so you don't need to add logic for that.

--
Jesse Houwing
jesse.houwing at sogeti.nl

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.