ListView: OnItemDataBound

Get dataItem onItemDataBound (don't forget to replace the bold parts with your objectname):

[code:c#]

protected void MainPostListView_ItemDataBound(object sender, ListViewItemEventArgs e)

{

YourObject item = (YourObject)((ListViewDataItem)e.Item).DataItem;

}

[/code]

 

Findcontrol within the itemtemplate:

[code:c#]

HyperLink hplTitle = (HyperLink)e.Item.FindControl("hyperLink");

[/code]

 

 

Leave a Reply

Your email address will not be published.