/// <summary> /// Add Update friendly url /// </summary> /// <param name="pageId">page id</param> /// <param name="friendlyurl">friendly url</param> private void AddUpdateFriendlyUrl(int pageId, string friendlyurl, int dynamicPageId, bool addExtension = true) { PagesDB pages = new PagesDB(); string result = string.Empty; if (drpPageList.SelectedValue == "-1") { if (addExtension) { result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text) + lblFriendlyExtension.Text, dynamicPageId); } else { result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text), dynamicPageId); } } else { //when friendlyURL saved, Set result as (0/1) result = pages.UpdateFriendlyURL(pageId, friendlyurl); } //If result get 0 then error message will display divErrorMessage.Visible = (result == "0"); //If result get 1 then success message will display divSuccessMessage.Visible = (result != "0"); //remove from cache SqlUrlBuilderProvider.ClearCachePageUrl(pageId); UrlBuilderHelper.ClearUrlElements(pageId); }