Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Generic Composite control (or any web control)

Thread Tools

Generic Composite control (or any web control)

Posts: n/a
I'm building a Composite control to reflect on an object and build a widget
for each of it's properties based on a custom set of attributes. I'm trying
to do it as a generic, and it works to render the control, but it won't
actually do anything when I try to access it... and infact, trying to access
it kills the vshost process in the debugging, so something is obviously
really wrong. (I've been all excited here becaue I'm using DynamicMethod to
access the properties and populate the controls, but when I go to access it
is the problem) Is it even possible to do Generic Webcontrols? I'm doing it
like this: (like I said, compiles and renders, just on post back, it kills my
server process)

ObjectWidget<AddressObject> addressEditor = new
addressEditor.ID = "FooBar";


// tried using findcontrol, but returns null, when I list control types
by enumerating them it actually shows one of the right type, at position 2
//AddressObject ao = (Page.Form.FindControl("FooBar") as

// yes I know not to do this in real life, I'm just trying to figure
this out
AddressObject ao = (Page.Form.Controls[2] as

// the Item property is of Type T, in this case AddressObject

// test
Response.Write(ao.Street + "<br/>");
Response.Write(ao.City + "<br/>");

Am I barking up the wrong tree? I can refactor it to take a property that
contains a System.Type but I'd also have to have a method of it that returns
a System.Object to access the internal value, which if you ask me is pretty

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
Control, Web Control and Composite Control shapper ASP .Net 6 12-26-2007 02:49 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Losing Composite Control property that another Composite Control ... Chad ASP .Net Building Controls 0 02-01-2005 09:01 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
Composite control with dynamic composite controls sleigh ASP .Net 1 02-12-2004 06:24 PM