C# 求高手详细解释每一段代码 在线等 每一段
namespace网上订餐系统.菜单{publicpartialclassList:System.Web.UI.Page{protectedvoidPage_Load(o...
namespace 网上订餐系统.菜单
{
public partial class List : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int pageSize=5 ;
int page;
int scid ;
int.TryParse(Request.QueryString["p"], out page);
int.TryParse(Request.QueryString["Scid"], out scid);
if (page <= 0)
{
page = 1;
}
SqlServer db = new SqlServer();
string condition = " 1=1 ";
if (scid > 0)
{
condition += " and Scid=@Scid";
db.AddSqlParameter("@Scid", scid);
db.SQL = "select 种类 from 菜分类表 where Scid=@Scid";
this.Literal系列名称.Text = (string)db.ExcuteScalar();
}
else
{
this.Literal系列名称.Text = "浏览菜单";
}
if (!string.IsNullOrEmpty(Request.QueryString["key"]))
{
condition += " and 菜名 like '%'+@key+'%'";
db.AddSqlParameter("@key", Request.QueryString["key"]);
this.Literal系列名称.Text += " > " + Request.QueryString["key"];
}
int recordCount;
DataTable dt = db.GetPagingInfo("菜单表", "*", condition,"cID desc" , page, pageSize, out recordCount);
this.DataList菜色. DataSource = dt; //告诉rptList控件,它要显示的数据来从哪儿
DataList菜色.DataBind();
this.PagingBar1.CurrentPage = page; 展开
{
public partial class List : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int pageSize=5 ;
int page;
int scid ;
int.TryParse(Request.QueryString["p"], out page);
int.TryParse(Request.QueryString["Scid"], out scid);
if (page <= 0)
{
page = 1;
}
SqlServer db = new SqlServer();
string condition = " 1=1 ";
if (scid > 0)
{
condition += " and Scid=@Scid";
db.AddSqlParameter("@Scid", scid);
db.SQL = "select 种类 from 菜分类表 where Scid=@Scid";
this.Literal系列名称.Text = (string)db.ExcuteScalar();
}
else
{
this.Literal系列名称.Text = "浏览菜单";
}
if (!string.IsNullOrEmpty(Request.QueryString["key"]))
{
condition += " and 菜名 like '%'+@key+'%'";
db.AddSqlParameter("@key", Request.QueryString["key"]);
this.Literal系列名称.Text += " > " + Request.QueryString["key"];
}
int recordCount;
DataTable dt = db.GetPagingInfo("菜单表", "*", condition,"cID desc" , page, pageSize, out recordCount);
this.DataList菜色. DataSource = dt; //告诉rptList控件,它要显示的数据来从哪儿
DataList菜色.DataBind();
this.PagingBar1.CurrentPage = page; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询