In aspx page:
<asp:ListView ID="ListViewPosts" ItemType="Post"
SelectMethod="ListViewPosts_GetData" runat="server"
OnItemDataBound="ListViewPosts_ItemDataBound">
...
...
</asp:ListView>
Code behind:
protected void ListViewPosts_ItemDataBound(object sender, ListViewItemEventArgs e)
{
...
Post p = Item; //where Item stands for the current Post record in ListView.
...
}
If I have this ListView
where in ItemType="Post"
; Post
is a database table.
How to access the current value of Item
(which stands for the current record from thePost
table) in the code behind method ListViewPosts_ItemDataBound
Try this:
Please note, Post should be DataRow if Post is the table.