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