Dear
i want to set my page title dynamically so when i run this code it is have error . please solution.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Title = DetailsView.FindControl("headline").Text.Trim();
}
}
<asp:DetailsView ID="DetailsView" runat="server"
AutoGenerateRows="False"
DataKeyNames="articleID" DataSourceID="AccessDataSourceDetailsView" Height="50px"
BorderWidth="0px" CellPadding="0" GridLines="None">
<RowStyle CssClass="rowstyle" />
<Fields>
<asp:TemplateField SortExpression="headline" ShowHeader="False">
<ItemTemplate>
<h2><asp:Label ID="headline" runat="server" CssClass="LinkHed" Text='<%# Bind("headline") %>'></asp:Label></h2>
<br />
<div align="left">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f887df5708fd1a0"></script>
<!-- AddThis Button END -->
</div>
<br />
به‌شی‌ <asp:Label CssClass="LinkPri" ID="Label1" runat="server" Text='<%# Bind("catName") %>'></asp:Label> له‌به‌رواری‌ :<asp:Label CssClass="LinkPri" ID="Label2" runat="server" Text='<%# Bind("publishDate") %>'></asp:Label>
<br />
<img src="App_Themes/Shewa/Images/fareza.png" style="border-top-style: 0; border-right-style: 0; border-bottom-style: 0; border-left-style: 0; border-width: 0px; border-top-color: 0; border-right-color: 0; border-bottom-color: 0; border-left-color: 0; float: right" />
<br />
<img src='<%# Eval("pic") %>' width="410" height="170" style="float: left" />
<asp:Label cssclass="LinkSum" ID="fullStory" runat="server" Text='<%# Bind("fullStory") %>'></asp:Label>
<img src="App_Themes/Shewa/Images/fareza1.png" style="border-style: 0; border-color: 0; border-width: 0px; float: left" />
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSourceDetailsView" runat="server" DataFile="App_Data/ASPNetDB.mdb"
SelectCommand="SELECT News_Articles.*, News_Categories.*, News_Articles.articleID AS Expr1 FROM (News_Articles INNER JOIN News_Categories ON News_Articles.catID = News_Categories.catID) WHERE (News_Articles.articleID = ?)"
UpdateCommand="UPDATE News_Articles SET hit = hit + 1">
<SelectParameters>
<asp:QueryStringParameter Name="articleID" QueryStringField="articalID"
Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>
Read more
Published: 1/1/0001 12:00:00 AM