Best Practice, creating a composite of controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a collection of controls I am using on several pages. I have:
1 Image
2 Labels

I want to combine these so that I will also have certain properties
available programatically.

I want to be able to set a 'photoId' Property, that, when set, will call
data from a database, set the Image's src property, and set the Label text.

I want 2 other properties (ReadOnly) to be available programatically, that
when the Get is fired, checks a couple of things and returns the result.

I know how to do all this, except to combine them in one control that I can
reuse. I'm doing it over and over again in 3 or 4 pages, but when I tried to
create a user control with codebehind, I am running into trouble.

Can you point me to online resources that could give me a walkthrough?
 
That helped, got me in the right direction. The thing I don't like, is now I
have to address my object like this:
CType(Me.Preview1, previewCtrl).ImageOrderNum = Me._jobNum
CType(Me.Preview1, previewCtrl).PhotoID = Me._photo

whenever I want to access properties.
Monday I am going to try to work on raising and handling events from that in
the consuming pageI am wondering if I may need to create my own server
control... but I'm not sure.
 
Back
Top