473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Best Practice, creating a composite of controls

M K
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?
Nov 18 '05 #1
3 1152
I learned how to do user controls from this MSDN article (there are a number
of sub-articles in the TOC on the left):
http://msdn.microsoft.com/library/de...bformspage.asp

Hope that helps.

"M K" wrote:
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?

Nov 18 '05 #2
I would highly recommend the book ASP.NET Server controls and components,
written by Nikhil Kothari.

http://www.nikhilk.net/ (look to the right)

It is singlely the best asp.net book I have read.

This one comes close, but really doesn't have anything to do with server
controls or asp.net.

http://www.amazon.com/exec/obidos/tg...59347?v=glance

HTH,

bill
"M K" <ma**@nospamcenturycolor.com> wrote in message
news:6D**********************************@microsof t.com...
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?

Nov 18 '05 #3
M K
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.

"Patridge" wrote:
I learned how to do user controls from this MSDN article (there are a number
of sub-articles in the TOC on the left):
http://msdn.microsoft.com/library/de...bformspage.asp

Hope that helps.

"M K" wrote:
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?

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
14
by: 42 | last post by:
Hi, Stupid question: I keep bumping into the desire to create classes and properties with the same name and the current favored naming conventions aren't automatically differentiating them......
1
by: sleigh | last post by:
Hello, I'm building a web application that will build a dynamic form based upon questions in a database. This form will have several different sections that consist of a panel containing one to...
2
by: Harry | last post by:
Hello, I have a composite WebControl that I'm dynamically instantiating at runtime using Reflection. When I create a new instance of my control I immediately iterate through it's child control...
4
by: Mark Olbert | last post by:
This involves a family of related, databound ASPNET2 composite controls. I've managed to arrange things so that the composite controls restore themselves from ViewState on postback after they're...
4
by: Ned Balzer | last post by:
Hi all, I am pretty new to asp.net; I've done lots of classic asp, but am just beginning to get my mind wrapped around .net. What I'd like to do is include some code that tests if a user is...
1
by: Peter Rilling | last post by:
Hi, I am creating some ASP.NET composite server controls (inheriting from CompositeControl). Right now I have the styles for the various objects hardcoded, but what I would like to do is allow...
6
by: shapper | last post by:
Hello, I am working in a class library with various custom controls. In which cases should a control inherit Control, WebControl and CompositeControl classes? And when should a custom...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.