I'm building a tiny blog app, and what I need to do is show blog post title for dynamically generated content page Item.aspx in page title.
In other words, i need data that is bound to this label in FormView to also be shown in page title when page loads.
<asp:Label ID="lblPostTitle" runat="server" Text='<%# Eval("PostTitle") %>' />
I'm using ObjectDataSource to get the data.
Tried a bunch of things, tried this (http://goo.gl/zWz1) to access Eval in code behind, but nothing worked.
Edit:
OK, i got the value from returned DataTable, it's easy
protected void odsItem_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
DataTable dt = (DataTable)e.ReturnValue;
string postTitle = dt.Rows[0]["PostTitle"].ToString();
}
But when I pass it to Page.Title nothing happens.
Please help.
Thank you.