Data binding to a CompositeControl



I am very new at using the CompositeControl or CompositeDataBoundControl and at DataBinding in general

My requirement is that I would like to declaratively tell my control to bind to a specific instance of a class; the control then looks at the metadata held in the instance to provide the appropriate control behavior.

The syntax follows the 'standard' <tag:controlname DataSource="here I don't know what to specify" />. What I want in "here I don't know what to specify" is something like instanceName.someFieldOrProperty, where the field (property) has a metadata to describe the behavior of the field.

From within the control I would like to be able to access the field via the DataSource property.

I thought of using an event driven approach and have the control.DataBinding event execute an event handler that would take the DataSource of some container (like a panel) and figure out the metadata in the field of the data source; but, this seems overly complex.

In a nutshell, given an instance fld containing a reference to someClass.someFieldOrProperty, I would like the more direct approach of using DataSource ="fld". Is 'fld' accessible within the code of the control?

Thanks

P.S. I have been following the very good examples in the newsgroup, but I have not figured this out yet.
.



Relevant Pages

  • RE: Facade for 3rd party controls, CompositeControl
    ... which again doesn't seem to be called when a control is ... so I can't override my CompositeControl.OnPreRenderand make it ... So while it sounds like a nice idea to throw a CompositeControl around it, ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • "ASP.NET 2005 custon server control" in "ASP.NET 2003 application"
    ... Could I create a custom server control in 2005 in order to leverage ... How good does ASP.NET 2005 handle a custom composite control inside ... Cntrl_A inherits from CompositeControl and does all sorts of neat stuff ...
    (microsoft.public.dotnet.framework.aspnet)
  • Building Composite Controls with the toolbox
    ... I'm trying to build a server control that inherits from CompositeControl, ... I would like it to be visible in the toolbox. ... I don't any problems with the second control (based on WebControl) only ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: CompositeControl fails to display in Design view
    ... For ascx user control scenario, it is just as if you put the control on the ... CompositeControl fails to display in Design view ... public class TestWebControlDesigner: ControlDesigner ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Continuing: Data binding to a CompositeControl
    ... My requirement is that I would like to declaratively tell my control to bind to a specific instance of a class; the control then looks at the metadata held in the instance to provide the appropriate control behavior. ... I thought of using an event driven approach and have the control.DataBinding event execute an event handler that would take the DataSource of some container and figure out the metadata in the field of the data source; ... So I am investigating TypeDescriptor driven design time modification. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)

Loading