Hi,
Could someone try to recommend the best cause of action to solve the request below:
I have created a number of extended classes using the Repeater class as a Base and love the flexibility, the ease and the results of doing this. What I want to to do now is to make a similar Custom Web Control for a single object (i.e the DataSource not implementing a IListSource or IEnumerable). I have created the structure of what I'm trying to achieve by extending the repeater and then when setting the datasource using a list of 1 item to hold the object and then databinding.
e.g a rough example:
    Dim oObj as New MyObject(1)
    Dim gl As New Generic.List(of MyObiect)()
    gl.Add(oObj)
    rpt.DataSource = gl
    rpt.DataBind()
This does seem like a small hack around things, what I would like to be able to do is the following:
e.g new call, where my control is the new custom control:
    Dim oObj as New MyObject(1)
    myControl.DataSource = oObj 
    myControl.DataBind()
I want to able to define this custom control with various variables and properties, the result of which will enable the following type of layout:
<My:ObjControl ID="frm" runat="server">
    <Tabs>
        <My:Tab name="Details">
            <Items>
                <My:Item Type="Text" Label="First Name" Property="FirstName" />
                <My:Item Type="Text" Label="Last Name" Property="LastName" />
                <My:Item Type="Text" Label="Title" Property="Title" />
            </Items>
        </Tab>
        <My:Tab name="Address">
            <Items>
                <My:Item Type="Text" Label="Address 1" Property="Address1" />
                <My:Item Type="Text" Label="Address 2" Property="Address2" />
                <My:Item Type="Text" Label="Address 3" Property="Address3" />
            </Items>
        </Tab>
    </Tabs>
</My:ObjControl>
This implementation has to take place using WebForms, although it looks like using MVC would be the ideal approach considering the above. By doing this I want to create a flexible WebControl that uses reflection (that can be used for all classes that implement a specific interface) which will generate the required form with only the three lines of code behind (above) each time it's needed.
Should I just add a property to a custom repeater (DataObject) that takes an object and sets the DataSource accordingly and saving my time? Or is there a better way?
Hope this all makes sense!
Cheers, Steve