Home > DeveloperSection > Forums > how use listview in asp.net?
Somesh

Total Post:21

Points:147
Posted on    November-08-2010 1:44 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 2081  View(s)
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


Alex R
Alex R

Total Post:40

Points:280
Posted on    November-13-2010 9:05 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick