Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 3rd, 2009, 11:20 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
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
  #2 (permalink)  
Old April 3rd, 2009, 11:27 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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)
  #3 (permalink)  
Old April 3rd, 2009, 11:32 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
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.
  #4 (permalink)  
Old April 3rd, 2009, 11:46 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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)
  #5 (permalink)  
Old April 3rd, 2009, 01:19 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
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(); 
}
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:48 PM.


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