|
-
Jan 13th, 2004, 10:26 AM
#1
Thread Starter
Frenzied Member
Web user controls and OO
I have a page where I have the same interface for 8 different attributes (2 listboxes, two buttons, one textbox) I added this
stuff in a user control.
But how can I use that user control form code? How do I reference to it? I have a controller class where I need to loop though each of the user controls and do stuff with the buttons and textboxes
kind regards
Henrik
-
Jan 13th, 2004, 12:18 PM
#2
PowerPoster
Expose properties and methods of the control as public.
Create a variable that holds a reference to it, and do what you need to with it.
-
Jan 13th, 2004, 01:32 PM
#3
Thread Starter
Frenzied Member
I see... so basically I can just drag/drop a usercontrol to my page
make an instance of it
dim myControl as new MyUserControl
and then access it by
myControl.Button1.text = "OK"
The reason is that I want to write a method that takes a usercontrol as in parameter, and fill it's listboxes with data...
Is it possible also to make a "for each" so I can loop though all usercontrols on the page/webform?
And a method that takes the usercontrol and save it's data to a database. Not really sure I should be doing that in the controller, but it is a small enough project.
kind regards
Henrik - a BIG fan of MVC
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
|