HOW USE LISTVIEW IN ASP.NET?

Somesh

Total Post:21

Points:147
Posted by  Somesh
 2340  View(s)
Ratings:
Rate this:
we use two listview as

<asp:ListView id="lv1">
<item template>
<asp:ListView id="lv2">...</asp:ListView>
</item template>
</asp:ListView>

My problem ,how bind the both listview as given example
please give sample of this example
  1. Alex R

    Post:40

    Points:280
    Re: how use listview in asp.net?

    Hello Yash,

    You can accomplish this task by initializing the DataSource of your second ListView.

    Here is the code for .aspx file

    <asp:ListView ID="lv1" runat="server" onitemdatabound="lv1_ItemDataBound">

    <ItemTemplate>

    <asp:ListView ID="lv2" runat="server">                   

    .

    .

    .

    </asp:ListView>

    </ItemTemplate>

    </asp:ListView>

    Now, write code for DataSource of lv1 in Page_Load event and for lv2 in ItemDataBound of lv1. But remember to find lv2 in lv1 in order to point to lv2.

    Here is the code for finding lv2.

    ListView lv2 = e.Item.FindControl("lv2") as ListView;

    Now you can use DataBound Property of lv2;

    For further details refer to this forum post:

    http://www.mindstick.com/Forum/45/ItemCommand%20Event%20in%20Nested%20Repeater%20and%20listview

    Hope this will help you.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!