popular.ascx.cs

来自「在线商店: C#、SQL和ASP编写」· CS 代码 · 共 56 行

CS
56
字号
namespace StoreOnline
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Configuration;
	using System.Data.SqlClient;

	/// <summary>
	///		Popular 的摘要说明。
	/// </summary>
	public class Popular : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.DataList MostPopularProductsList;

		private void Page_Load(object sender, System.EventArgs e)
		{
			//通过调用数据库访问公共类的GetMostSoldBooks成员函数获取销售最好的商品的列表,并显示出来
			StoreOnline.StoreDBO myProStoreDBO = new StoreOnline.StoreDBO();
			MostPopularProductsList.DataSource = myProStoreDBO.GetMostSoldProducts();
			MostPopularProductsList.DataBind();
            
			if (MostPopularProductsList.Items.Count == 0)
			{
				MostPopularProductsList.Visible = false;
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		
	}
}

⌨️ 快捷键说明

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