How to display property list<> from ObjectDataSource to ListView

Posted on 2008-11-03
Last Modified: 2013-12-17
Dear Experts,

is it possible to put <asp:listview /> in <asp:listview /> ?
How to display RoomTypeName and RoomAmenities to the ListView Control from ObjectDataSource?

Thank you.

public class RoomInformation


        public string RoomTypeName { get; set; }

        public List<string> RoomAmenities { get; set; }


public List<RoomInformation> GetRoomInformation()


<asp:ListView ID="ListViewRoomInformation" runat="server" DataSourceID="objRoomInformation">


            <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>





<asp:ObjectDataSource ID="objRoomInformation" runat="server"





Open in new window

Question by:hotex
    LVL 18

    Accepted Solution

    i did something similar. i fastly adapted it, but you should get the point...
    it work wit 2 neasted ListView, so you should add a ListViewRoomAmenities listview
    Sorry, but it<s a

    Protected Sub ListViewRoomInformation_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)
            'check if it's a item
            If e.Item.ItemType = ListItemType.AlternatingItem Or _
                e.Item.ItemType = ListItemType.Item Then
                'get the item's data
                Dim RoomInformationData As RoomInformation = CType(e.Item.DataItem, RoomInformation)
                Dim RoomAmenities As ListView = e.Item.FindControl("ListViewRoomAmenities")
                RoomAmenities.DataSource = RoomInformationData.RoomAmenities 
            End If
        End Sub

    Open in new window


    Author Comment

    Thank you for the solution davrob60, but finally I choose to use 2 objectDataSource :)

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now