473,789 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1175
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**@nospamcen turycolor.com> wrote in message
news:6D******** *************** ***********@mic rosoft.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.Previe w1, previewCtrl).Im ageOrderNum = Me._jobNum
CType(Me.Previe w1, previewCtrl).Ph otoID = 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
9273
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 C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
136
9460
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
14
3141
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... (both are "Pascal Case" with no leading or trailing qualifiers). For example... I'll be modelling something, e.g. a computer, and I'll
1
3153
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 many questions. To keep it simple, I'll describe the basics of what I'm trying to design. I've created a TextBox composite control that consists of a label for
2
1850
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 collection (it has about 4 child controls). The problem is none of these controls are loaded or accessible when I create the instance since, I believe, they are created by the server at a later point in time. How could I force my composite control...
4
4091
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 initially configured during DataBind(). Thanks to Steven Cheng for pointing out that you have to set the constituent control properties after you add them to the composite control collection for the restore to work! However, I now have a...
4
1841
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 logged in, on each and every page, and redirects the user to a login page if s/he's not logged in. The login page will also take care of some standard setup, such as choosing/populating a user profile. I used to use <!-- #include ... --for this,...
1
1631
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 the user to use a stylesheet without actually knowing the internal structure of the control. I am insterested in knowing some of the best pracises for using stylesheets with composite controls. For example, when a person sets a border style on...
6
2633
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 control implement INamingContainer? In this moment I am working on a custom control that is composed by a
0
9506
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10193
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.