/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = categoryDal.GetCategoryList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
void showdetailinfo() { ddlcategorylist.Items.Clear(); MSProductCategoryDAL selectcategoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = selectcategoryDal.GetCategoryList(" and UpID='' and [SID]!='' "); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "顶级导航"; dt.Rows.InsertAt(firstdr, 0); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet categoryDs = categoryDal.GetCategoryDetail(strID); MSProductCategory categoryModel = DataConvert.DataRowToModel <MSProductCategory>(categoryDs.Tables[0].Rows[0]); cname.Text = categoryModel.Cname; string parm = string.Empty; if (categoryModel.UpID.Trim() != null && categoryModel.UpID.Trim() != "") { parm = categoryModel.UpID; } else { parm = "0"; } ddlcategorylist.SelectedIndex = ddlcategorylist.Items.IndexOf(ddlcategorylist.Items.FindByValue(parm)); sortin.Text = categoryModel.Sortin.ToString(); if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (Request["sid"] != null && Request["sid"] != "") { sid = " and [SID]=" + Request["sid"] + " "; } else { sid = " and [SID]!='' "; } ddlcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetCategoryList(" and UpID='' " + sid); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Cname"] = "--全部--"; dt.Rows.InsertAt(dr, 0); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "顶级导航"; dt.Rows.InsertAt(firstdr, 1); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); AspNetPager1.CurrentPageIndex = 1; string s = " and UpID='' " + sid; ViewState[vsKey] = s; LoadData(s); } else { return; } } }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { ddlcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetCategoryList(" and UpID='' and [SID]!='' "); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Cname"] = "--请选择类别--"; dt.Rows.InsertAt(dr, 0); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "--添加顶级导航--"; dt.Rows.InsertAt(firstdr, 1); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); #region 初始化界面 if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } #endregion } else { return; } } }
/// <summary> /// 获取类别列表 /// </summary> void GetOptionList() { string subid = string.Empty; if (Request["subid"] != null && Request["subid"] != "") { subid = Common.Common.NoHtml(Request["subid"]); subid = " and UpID='" + subid + "' "; } if (sid != null && sid != "") { sid = " and [SID]='" + sid + "' "; } MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetCategoryList(subid + sid + " and CsecHand=0 "); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { Response.Write(Dataset2Json(ds)); } Response.End(); }