Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How to access properties of "user control" in code-behind?

 

I notice that for web control, vs.net will automatic generate code like:

 

Protected WithEvents WelcomeMsg As System.Web.UI.WebControls.Label

 

But for "user control", there are not. So, how do we access those properties of this "user control"?:confused:

  • *Gurus*
Posted

I've never actually handled UserControls like that, so I'll look into it and get back to you. For now try adding the following line to the codebehind:

 

Protected WithEvents [i]ControlID[/i] As System.Web.UI.UserControl

 

I imagine that'll work unless you're attempting to access programmer defined properties.

  • *Gurus*
Posted
[mshelp=ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconexposingpageletproperties.htm]This help document[/mshelp] explains the process of implementing programmer defined properties in a UserControl. It might not be exactly what you want, but that's how it's done for the most part.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...