469,076 Members | 1,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,076 developers. It's quick & easy.

hooking into the validation summary control, adding a custom errormessage

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?
Mar 3 '08 #1
1 2381
Hello DotNetNewbie,
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?
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
Mar 3 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by A.M | last post: by
2 posts views Thread by TIBM | last post: by
1 post views Thread by Buddy Ackerman | last post: by
12 posts views Thread by Dabbler | last post: by
4 posts views Thread by kpg | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.