Is the .Net repeater equivalent for a single object?

Can anyone try to recommend the best reasons to solve the following request:

I created several advanced classes using the Repeater class as a base and I love the flexibility, lightness and results of this. Now I want to make a similar custom web control for a single object (i.e. the DataSource does not implement IListSource or IEnumerable). I created the structure of what I am trying to achieve by expanding the repeater and then setting the data source using a list of 1 items to store the object and then data binding.

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 seems like a little hack around the things that I would like 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()

, , :

<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>

WebForms, , MVC . , WebControl, ( , ), () , .

(DataObject), DataSource ? ?

, !

Cheers,

+5
3

, , 1 . * oObj) . .

, , , . , .

<asp:repeater id="whatever" runat=server>
   <ItemTemplate>First Name: <%# DataBinder.Eval(Container.DataItem,"FirstName") %></ItemTemplate>
</asp:repeater>
+5

, . , ASP.NET Framework , ListView, . , , , Repeater ListView. , . , . ASP.NET - Framework, , . http://gadgetopia.com/post/5343 , -: , . , ASP.NET ItemView

+2
+1

All Articles