protected void Page_Load(object sender, EventArgs e) { Recipe.WhatPageID = constant.intRecipeDetails; Recipe.ID = (int)Util.Val(Request.QueryString["id"]); //Fill up database fields Recipe.fillup(); //Initialize variables to use for aspx page. RecCatId = Recipe.CatID; strRName = Recipe.RecipeName; strCName = Recipe.Category; RecipeSection = constant.intRecipe; recipeimage.Visible = false; //Display recipe image if exist. if (!string.IsNullOrEmpty(Recipe.RecipeImage)) { recipeimage.Visible = true; recipeimage.ImageUrl = GetRecipeImage.ImagePathDetail + Recipe.RecipeImage; } lbcountcomment.Text = Recipe.CountComments.ToString(); lblname.Text = Recipe.RecipeName; lblauthor.Text = Recipe.Author; lblhits.Text = string.Format("{0:#,###}", Recipe.Hits); lblrating.Text = Recipe.Rating; lblvotescount.Text = Recipe.NoRates; lblcategorytop.Text = Recipe.Category; lbldate.Text = Recipe.Date.ToShortDateString(); lblIngredients.Text = Util.FormatText(Recipe.Ingredients); lblInstructions.Text = Util.FormatText(Recipe.Instructions); starimage.ImageUrl = Utility.GetStarImage(Recipe.Rating); //Save to Favorite/Bookmark URL strBookmarkURL = Bookmark.URL; //Get dynamic page title and keywords GetMetaKeywords(DynamicKeywords.Keywords(constant.intRecipeDynamicKeywordDetails, Recipe.RecipeName.ToString() + " recipe, " + Recipe.Category.ToString() + " recipe")); //Display New and Popular image ShowNewPopularImage(); //Get 15 related recipes datatable. GetRelatedrecipes(); //Get user recipe cookie rating GetUserRecipeCookieRating(); //Get Recipe Comment GetComments(); //Release allocated memory Util = null; Recipe = null; }
private void GetMetaTitleTagKeywords() { //Get Page title and keywords SortBy = (int)Util.Val(Request.QueryString["sid"]); string strPageTitleAndKeywords = DynamicKeywords.Keywords(constant.intRecipeDynamicKeywordSortPage, SortBy); string[] arrayPagetitleAndKeywords = strPageTitleAndKeywords.Split(','); GetMetaTitleTagKeyword(arrayPagetitleAndKeywords[0], arrayPagetitleAndKeywords[1]); }
//Handle dynamic page title and keywords private void GetMetaTitleTagKeywords(string strPageTitle) { iPage = (int)Util.Val(Request.QueryString["page"]); string GetCategoryName; GetCategoryName = strPageTitle + " Recipes "; //Assign page title and meta keywords Page.Header.Title = PageTitle.Title(GetCategoryName, iPage); HtmlMeta metaTag = new HtmlMeta(); metaTag.Name = "Keywords"; //You can add more keywords if you want. metaTag.Content = strPageTitle + DynamicKeywords.Keywords(constant.intRecipeDynamicKeywordCategory); this.Header.Controls.Add(metaTag); }