views:

26

answers:

0

Hey SO,

I am trying to create a User Control that accepts a generic List of CustomObject as a bindable property. I've hit a wall and can't figure it out. Any help would be greatly appreciated!

I'd like it to look a little somthing like this :

TabularReport.ascx

 [Bindable (true)]
    public IList<T> Source
    { 
    get; 
    set; 
    }

    protected void Page_Load(object sender, EventArgs e)
    {
     //do Reflection here
    //Populate Table
    //etc.
    }

Then from each Page... call this User Control like so

SomePage.aspx

 protected void Page_Load(object sender, EventArgs e)
    {
    IList<CustomObject> data = MyBusinessLayer.GetSomeData();
    TabularReport reportUserControl = new TablularReport();
    reportUserControl.Source = data;

    somePlaceHolder.Controls.Add(reportUserControl);
    }

Is something like this even possible? Am I looking at it from the wrong direction?

Thanks.