Link to home
Start Free TrialLog in
Avatar of aspnet-scotland
aspnet-scotlandFlag for United Kingdom of Great Britain and Northern Ireland

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.
//***********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)   
    {   
        ??????   
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aspnet-scotland

ASKER

Thanks.