Andi03 Posted September 18, 2003 Posted September 18, 2003 (edited) ValidationControll to check if value excists in database??? Hi. I have form that you use to signup on my page. Is there any way to use a valitaor control to check for a value in a database? There is a CompareValidator but I cant get it to check if a value excists in a database. The value I want to check is if the username that is used on the regform already excists in the database. Is it possible? //Andi Edited September 18, 2003 by Andi03 Quote
Administrators PlausiblyDamp Posted September 18, 2003 Administrators Posted September 18, 2003 You could use a custom validator and in the server side validate event do the database check. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Andi03 Posted September 18, 2003 Author Posted September 18, 2003 How would I do that? Im new at this. Quote
Administrators PlausiblyDamp Posted September 18, 2003 Administrators Posted September 18, 2003 On the toolbox amongst the other validator controls there is one called CustomValidator Add it to the page like any other validator and set the ControlToValidate Property to the control you want to validate. Double click the control and it should open the code behind in an event calle something like ServerValidate - put the validation logic in here. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Andi03 Posted September 18, 2003 Author Posted September 18, 2003 Can I call a function or subroutine there? Quote
Administrators PlausiblyDamp Posted September 18, 2003 Administrators Posted September 18, 2003 Certainly. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Andi03 Posted September 18, 2003 Author Posted September 18, 2003 Lets say I have made a Function that returns the value True or False. How would the Validation control know when to display the message (The username already excists) Quote
Administrators PlausiblyDamp Posted September 19, 2003 Administrators Posted September 19, 2003 within the serverValidate Event args.IsValid = Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.