aspnet-scotland
asked on
Repeater ItemDataBound event to Listview ItemDataBound event.
Hi,
I have the attached code that works for an asp.net repeater but I need to convert the logic so it works for an asp.net listview control...possible? The same code throws errors when placed within my listview's itemdatabound event.
Thanks.
I have the attached code that works for an asp.net repeater but I need to convert the logic so it works for an asp.net listview control...possible? The same code throws errors when placed within my listview's itemdatabound event.
Thanks.
//***********REPEATER*****************
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
ContentRating myRating = e.Item.FindControl("Rating1") as ContentRating;
if (myRating != null)
{
Book myBook = e.Item.DataItem as Book;
if (myBook != null)
{
myRating.ItemId = myBook.Id;
myRating.DataSource = myBook.Rating;
}
}
}
}
//**********LISTVIEW**************
protected void lvTrustAccounts_ItemDataBound(object sender, ListViewItemEventArgs e)
{
??????
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER