Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Refer to a custom property of a dynamically loaded user control

Reply
Thread Tools

Refer to a custom property of a dynamically loaded user control

 
 
Bryan Holland
Guest
Posts: n/a
 
      11-17-2003
I have an app where I dynamically load a user control based on the type of
data it is rendering. There are some standard custom properties that I want
to access.

How do I refer to a custom property of a dynamically loaded user control?

Thanks

B


 
Reply With Quote
 
 
 
 
Dave Rothgery
Guest
Posts: n/a
 
      11-17-2003

"Bryan Holland" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have an app where I dynamically load a user control based on
> the type of data it is rendering. There are some standard custom
> properties that I want to access.


> How do I refer to a custom property of a dynamically loaded user control?


I'm not sure if this will help you (depends on where in the control life
cycle you need to access properties at), but what I've done to set user
control properies is something like this...

[in VB.NET, where I'm loading a user control in response to a button click,
then adding it to a PlaceHolder]

Private Sub myButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles myButton.Click
Dim ctrl As myUserCtrl

ctrl = CType(Page.LoadControl("myUserCtrl.ascx"), myUserCtrl)
ctrl.myProperty = "value"

myPlaceHolder.Controls.Add(ctrl)
End Sub

--
Dave Rothgery


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access the Property of User Controls which are loaded Dynamically? rakesh.mwisp ASP .Net 0 09-16-2008 10:27 AM
FWD: Help: Control lost doesn't raise event after being moved to dynamically loaded user control Tonix ASP .Net Web Controls 0 08-24-2004 05:42 AM
FWD: Help: Control lost doesn't raise event after being moved to dynamically loaded user control Tonix ASP .Net 0 08-24-2004 05:26 AM
Help: Control lost doesn't raise event after being moved to dynamically loaded user control Thanh Nguyen ASP .Net 0 04-01-2004 02:23 AM
java -verbose doesn't show "loaded from" for classes loaded from custom jars in the classpath Udo Corban Java 0 01-23-2004 09:32 AM



Advertisments