I'm looking at the code of the "ShowArticle.aspx" page and see that the page title is set to: Title="The Beer House - Article: {0}".
Where is the article name being defined - the {0} code? I see the following in the code-behind:
// if we get here, display all article's data on the page
this.Title = string.Format(this.Title, article.Title);
lblTitle.Text = article.Title;
But, is the name getting into the title that is shown in the browser?
Yes, that's how the string.Format() method works. It takes the second parameter (article.Title) and substitutes it where the {0} appears in the first parameter (this.Title).
So, if the article were called "Top 10 Brewing Methods", the title in the browser would display "The Beer House - Article: Top 10 Brewing Methods"
JamesSAEP
Member
66 Points
237 Posts
Article Titles
Sep 15, 2008 10:17 PM|LINK
I'm looking at the code of the "ShowArticle.aspx" page and see that the page title is set to: Title="The Beer House - Article: {0}".
Where is the article name being defined - the {0} code? I see the following in the code-behind:
// if we get here, display all article's data on the page
this.Title = string.Format(this.Title, article.Title);
lblTitle.Text = article.Title;
But, is the name getting into the title that is shown in the browser?
Lee Dumond
Contributor
6404 Points
1173 Posts
Re: Article Titles
Sep 16, 2008 12:12 AM|LINK
Yes, that's how the string.Format() method works. It takes the second parameter (article.Title) and substitutes it where the {0} appears in the first parameter (this.Title).
So, if the article were called "Top 10 Brewing Methods", the title in the browser would display "The Beer House - Article: Top 10 Brewing Methods"
Make sense?
Follow Me on Twitter