-
Feb 27th, 2007, 08:47 AM
#1
Thread Starter
New Member
passing a webpage as a parameter to a vb class function?
Hello,
I'm simply trying to validate textboxes and dropdownlists etc on an asp web form. I have the code to loop through all of the child controls on the htmlform, but I can't figure out how to pass an instance of the webform to a vb class function. I am doing this because I have to validate controls an several forms and it gives me more control over validation than if I used the gui provided in the toolbox (RequiredFieldValidator).
Does anyone know how to do this?
Thanks,
Chieko
-
Feb 27th, 2007, 10:14 AM
#2
Fanatic Member
Re: passing a webpage as a parameter to a vb class function?
Ckuroda,
Firstly welcome to the forums
From the look of your question it appears that you have posted in the wrong forum, this is the ASP classic, VB Script forum which means you probably won't get as many responses as you'd like. In the future you should post asp.net related questions in the asp.net forum click here to check it out
Right back to your question.
In your class your create a function somthing like this -
Code:
Public Function Validation(ByRef myPage As Page) As Boolean
Dim bRet As Boolean = True
' Loop page Or form If Error Do what you have To Do And Set bRet=False
Return bRet
End Function
In the webform or webform codebehind page in the submit click event -
Code:
If myClass.Validation(Me)=True Then
' No Error call save Function
Else
' An Error has occurred return To form displaying list of errors
End If
Cheers Al
-
Feb 28th, 2007, 09:39 AM
#3
Thread Starter
New Member
Re: passing a webpage as a parameter to a vb class function?
Al, Thanks. That did the job.
Cheers,
Chieko
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|