Wrox Programmer Forums
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 3rd, 2009, 11:20 AM
Authorized User
 
Join Date: Jun 2008
Posts: 75
Thanks: 15
Thanked 0 Times in 0 Posts
Default Web User Control

I was wondering can you expose a web user controls properties to the designer?

Also does anyone know where I can find some good articles or literature on how to create a web user control using Visual Basic? I found that every time I do a search for an example on how to create a web user control it is always in C#.


Thanks In Advance
 
Old April 3rd, 2009, 11:27 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What kinds of properties do you want ot expose on the designer? If, for example, you want to be able to provide a custom string to the User Control at design time you could add code like this in your User Control:

Public Property MyCustomString as String
'Getters and settors
End Property

Then on the designer you would see a property called MyCustomString that you could supply a value for.

As far as literature on creating Web User Controls in VB, I don't know of any off hand. Google it.

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
The Following User Says Thank You to dparsons For This Useful Post:
dotnetDeveloper (April 3rd, 2009)
 
Old April 3rd, 2009, 11:32 AM
Authorized User
 
Join Date: Jun 2008
Posts: 75
Thanks: 15
Thanked 0 Times in 0 Posts
Default Web user control

Thanks for your help. I want to expose the text property of a label control. Someone told me that only custom user controls can expose there properties to the designer. I will give what you reccomended a try. Thanks for your help.
 
Old April 3rd, 2009, 11:46 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am not real sure what a 'custom user control' is. By shear definition all user controls are custom since they require the developer to implement all of the functionality. In any event you could simply do something like this in your settor of the property:

labe1.Text = Value

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
The Following User Says Thank You to dparsons For This Useful Post:
dotnetDeveloper (April 3rd, 2009)
 
Old April 3rd, 2009, 01:19 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
Originally Posted by dotnetDeveloper View Post
Thanks for your help. I want to expose the text property of a label control. Someone told me that only custom user controls can expose there properties to the designer. I will give what you reccomended a try. Thanks for your help.
Doug / dotNet,

I think what dND means above is a custom server control. It is easy to confuse user controls with custom server controls if you are not aware there's a BIG difference.

A user control exposes its properties declaratively, and also makes them available in the Properties pane. However, if you need to expose properties to the designer, make them available from the toolbox, etc... like a regular ASP.NET web server control, you do need to make a custom server control.

Custom server controls are a very advanced topic. Whole books are written on how to compose them. Wrox has a pretty good one on the subject.

You should be able to find a simple example in VB on the MSDN. However, unless you are creating a web control library to reuse in many projects, or as part of a package you want to resell or something, then it's probably not worth the effort.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web User Control dotnetDeveloper ASP.NET 3.5 Professionals 4 March 21st, 2009 05:41 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
Web User Control Problem jbenson001 ASP.NET 1.x and 2.0 Application Design 12 January 18th, 2005 03:56 PM
Web user control EvilGuyWhoEatsBrains General .NET 1 December 14th, 2004 01:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.