private void AddVerticalTab(string tabHeaderId, Control detailControl, string tabHeaderValue, bool isTabSelected) { if (string.IsNullOrEmpty(tabHeaderValue)) { tabHeaderValue = tabHeaderId; } var oMyData = new MyTabTrackingData(); oMyData.Key = tabHeaderId; // * * * * * * // accordion header // * * * * * * var accordinHeader = new HtmlGenericControl("h3"); accordinHeader.InnerText = tabHeaderValue; accordinHeader.ID = "h3" + tabHeaderId; accordinHeader.Attributes["myTabIndex"] = myListTabTracking.Count.ToString(); divTabContentContainer.Controls.Add(accordinHeader); // * * * * * * // accordion child control // * * * * * * var divAccordion = new HtmlGenericControl("div"); divAccordion.Attributes.Add("class", ApplicationCommon.DetailsBorderClassName); //"#TabContent-" + tabId.Replace(" ", string.Empty); if (detailControl != null) { if (GenericControl == null) { GenericControl = detailControl; } divAccordion.Controls.Add(detailControl); } oMyData.Target = divAccordion; divTabContentContainer.Controls.Add(divAccordion); myListTabTracking.Add(oMyData); }
public void Setup(string userPreferenceCategory, bool isBindAllTabs = true) { IsBindAllTabs = isBindAllTabs; SettingCategory = userPreferenceCategory; // Get Tab Orientation based on UPCategory if (!string.IsNullOrEmpty(SettingCategory)) { PerferenceUtility.CreateUserPreferenceCategoryIfNotExists(SettingCategory, SettingCategory); } TabOrientation = PerferenceUtility.GetUserPreferenceByKeyAsTabOrientation(ApplicationCommon.TabOrientation, SettingCategory); hdnTabOrientation.Value = TabOrientation.ToString(); IsAllTab = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.AllTabExists, SettingCategory); if (IsAllTab) { IsAllTabSelected = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.AllTabSelected, SettingCategory); } if (TabOrientation == TabOrientation.Vertical) { //divTabContainer.Visible = false; TabHeaderBackgroundColor = PerferenceUtility.GetApplicationUserPreferenceByKey(ApplicationCommon.TabHeaderBackgroundColor); } else { if (IsAllTab) { var divAllTabPage = new HtmlGenericControl("div"); divTabContentContainer.Controls.Add(divAllTabPage); var oMyData = new MyTabTrackingData(); oMyData.Key = "All"; oMyData.Target = divAllTabPage; var liAllTabElement = CreateTabItemHeader("All", "All", IsAllTabSelected, oMyData, divAllTabPage.ClientID); myListTabTracking.Add(oMyData); divTabHeaderList.Controls.Add(liAllTabElement); } } }
private void AddHorizontalTab(string tabHeaderId, Control detailControl, string tabHeaderValue, bool isTabSelected) { if (string.IsNullOrEmpty(tabHeaderValue)) { tabHeaderValue = tabHeaderId; } var oMyData = new MyTabTrackingData(); oMyData.Key = tabHeaderId; // * * * * * * // tab page // * * * * * * var divTabPageHeader = new HtmlGenericControl("div"); divTabPageHeader.ID = "divTabPageHeader" + tabHeaderId; divTabPageHeader.InnerHtml = tabHeaderValue; divTabPageHeader.Attributes.Add("class", "tab-header"); divTabPageHeader.Style["display"] = "none"; var divTabPage = new HtmlGenericControl("div"); //divTabPage.Attributes.Add("class", ApplicationCommon.DetailsBorderClassName + " row col-sm-12"); // Add Tab Header divTabPage.Controls.Add(divTabPageHeader); //"#TabContent-" + tabId.Replace(" ", string.Empty) if (detailControl != null) { if (GenericControl == null) { GenericControl = detailControl; } divTabPage.Controls.Add(detailControl); } oMyData.Target = divTabPage; // tab header var liTabElement = CreateTabItemHeader(tabHeaderId, tabHeaderValue, isTabSelected, oMyData, divTabPage.ClientID); // add 'ALL' Tab Last ... though it will be ordered in the manner its called if (IsAllTab) { divTabHeaderList.Controls.AddAt(divTabHeaderList.Controls.Count - 1, liTabElement); divTabContentContainer.Controls.AddAt(divTabContentContainer.Controls.Count - 1, divTabPage); myListTabTracking.Insert(myListTabTracking.Count - 1, oMyData); } else { divTabHeaderList.Controls.Add(liTabElement); divTabContentContainer.Controls.Add(divTabPage); myListTabTracking.Add(oMyData); } divTabPage.Visible = true; // TO-REVIEW: not in favor of IsTesting embeded here if (!SessionVariables.IsTesting || IsAllTab) { var xInnerDiv = new HtmlGenericControl("div"); xInnerDiv.InnerHtml = "<table class='sectionTabName' width='100%'><tr><td align='left'>" + tabHeaderValue + "</td></tr></table>"; xInnerDiv.Visible = true; divTabPage.Visible = true; } else if (isTabSelected) { divTabPage.Visible = true; } }
//private HtmlGenericControl GetBlankDiv() //{ // var xDiv = new HtmlGenericControl("div"); // xDiv.Attributes.CssStyle.Add("height", "0px"); // return xDiv; //} private HtmlGenericControl CreateTabItemHeader(string tabId, string tabHeaderValue, bool isTabSelected, MyTabTrackingData oMyData, string contentClientId = "") { var liTabElement = new HtmlGenericControl("li"); liTabElement.ID = "li" + tabId; // highlight the section background if (string.IsNullOrEmpty(LastSelectedTab) && isTabSelected && !IsAllTabSelected) { liTabElement.Attributes.CssStyle.Add("background-color", "Yellow"); } else if (LastSelectedTab == tabId) { liTabElement.Attributes.CssStyle.Add("background-color", "Yellow"); } var aLink = new HtmlGenericControl("a"); aLink.Attributes.Add("href", "#" + contentClientId); aLink.InnerHtml = "<span>" + tabHeaderValue + "</span>"; // null in case of All Tab Li Item if (oMyData != null) { oMyData.Link = aLink; } // case for bind all, Client side Hypelinks won't be visible. if (!IsBindAllTabs) { aLink.Style.Add("display", "none"); } liTabElement.Controls.Add(aLink); // case for bind all, only server side hyperlinks will be created/visible if (!IsBindAllTabs) { // add button to enable clicking on tab var btnTabNavButton = new LinkButton(); btnTabNavButton.Text = tabHeaderValue; btnTabNavButton.CommandArgument = tabId; btnTabNavButton.Click += TabNavButton_Click; liTabElement.Controls.Add(btnTabNavButton); } return(liTabElement); }