preferences.ascx.cs

来自「这是《四酷全书》里三“酷”的源码」· CS 代码 · 共 47 行

CS
47
字号
using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookShop.Web.Controls {
	public abstract class Preferences : UserControl {
	
		protected System.Web.UI.WebControls.DropDownList listLanguage;
		protected System.Web.UI.WebControls.DropDownList listCategory;
		protected System.Web.UI.WebControls.CheckBox chkShowFavorites;
		protected System.Web.UI.WebControls.CheckBox chkShowBanners;

		// Control property to show list of language
		public string Language {
			get { return WebComponents.CleanString.InputText(listLanguage.SelectedItem.Value, 50); }
			set { 
				ListItem item = listLanguage.Items.FindByValue(value);
				if (item != null){
					item.Selected = true;
				}
			}
		}

		// Control property to show list of categorys
		public string Category {
			get { return WebComponents.CleanString.InputText(listCategory.SelectedItem.Value, 50); }
			set { 
				ListItem item = listCategory.Items.FindByValue(value);
				if (item != null){
					item.Selected = true;
				}
			}
		}

		// Control property to show checkbox for show favorites list
		public bool IsShowFavorites {
			get { return chkShowFavorites.Checked; }
			set { chkShowFavorites.Checked = value; }
		}

		// Control property to show checkbox for show banners
		public bool IsShowBanners {
			get { return chkShowBanners.Checked; }
			set { chkShowBanners.Checked = value; }
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?