Mercurial > pub > bltoolkit
view Demo/Asp.Net/Web/Controls/NavigationControl.ascx.cs @ 9:1e85f66cf767 default tip
update bltoolkit
author | nickolay |
---|---|
date | Thu, 05 Apr 2018 20:53:26 +0300 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System; using System.Web.UI; using System.Web.UI.WebControls; using PetShop.BusinessLogic; namespace PetShop.Web { public partial class NavigationControl : UserControl { // Control layout property. // private string _controlStyle; protected string ControlStyle { get { return _controlStyle; } } // Get properties based on control consumer. // protected void GetControlStyle() { if (Request.ServerVariables["SCRIPT_NAME"].ToLower().IndexOf("default.aspx") > 0) _controlStyle = "navigationLinks"; else _controlStyle = "mainNavigation"; } protected void Page_Load(object sender, EventArgs e) { GetControlStyle(); BindCategories(); // Select current category. // string categoryId = Request.QueryString["categoryId"]; if (!string.IsNullOrEmpty(categoryId)) SelectCategory(categoryId); } // Select current category. // private void SelectCategory(string categoryId) { foreach (RepeaterItem item in repCategories.Items) { HiddenField hidCategoryId = (HiddenField)item.FindControl("hidCategoryId"); if (hidCategoryId.Value.ToLower() == categoryId.ToLower()) { HyperLink lnkCategory = (HyperLink)item.FindControl("lnkCategory"); lnkCategory.ForeColor = System.Drawing.Color.FromArgb(199, 116, 3); break; } } } // Bind categories. // private void BindCategories() { repCategories.DataSource = new ProductManager().GetCategoryList(); repCategories.DataBind(); } } }