Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Property on Custom Control

Thread Tools

Property on Custom Control

Posts: n/a
I have a usercontrol with som propertys. I want to make a public
function that loads this control, add the values to the propertys and
put the control in a placeholder. The code remains in the App_Code

My problem is that the control(as far as i know) doesnt load. Here is
the Code

Dim toc As New UserControl
toc.AppRelativeTemplateSourceDirectory =
toc.AppRelativeVirtualPath =

Dim CurrentType As Type = toc.GetType()
Dim cAttrib As System.Reflection.PropertyInfo =
Dim cAttrib1 As System.Reflection.PropertyInfo =
cAttrib.SetValue(toc, FieldName,
Reflection.BindingFlags.SetProperty, Nothing, Nothing, Nothing)
cAttrib1.SetValue(toc, TmpHiddenAlfa,
Reflection.BindingFlags.SetProperty, Nothing, Nothing, Nothing)

When i get to "cAttrib.SetValue(toc, FieldName,
Reflection.BindingFlags.SetProperty, Nothing, Nothing, Nothing)"
i get an error "Object Reference not set to an instance of an object"
And toc.controls.count return 0

Reply With Quote

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
feeding a SQLDataSource embedded in an .ascx user control a custom property assigned to that control ASP .Net 4 07-16-2006 12:20 PM
Custom Attributes (AttributeTargets.Property) and Property Type Zarko Gajic ASP .Net Building Controls 0 04-07-2005 02:20 PM
Custom Control : One custom property to array of controls anon ASP .Net Web Controls 0 01-15-2005 11:32 AM
Keep custom property-value in custom rendered control Rob Joosen ASP .Net Building Controls 0 05-12-2004 11:56 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM