protected void Page_PreRender(object sender, EventArgs e) { url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; string ChannelTitle = null; // 痕迹&栏目标题 if (Request.QueryString["alias"] == null) { Response.Redirect("HomeLite.aspx"); } else { SetAliasAndIsChild(); } string CategoryGUID = DataQuery.CategoryAliasToID(alias); string CategoryPath = DataQuery.CategoryPath(CategoryGUID); char[] PathSeparator = { '/' }; string[] CategoryPaths = CategoryPath.Split(PathSeparator); ChannelAlias = DataQuery.CategoryIDToAlias(CategoryPaths[4]); string Lv2Alias = DataQuery.CategoryIDToAlias(CategoryPaths[5]);//2级分类 ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); //CurrentTrace.Text = ChannelTitle; CurrentCategoryName.Text = ChannelTitle; //竖导航 String Lv2sAlias = ChannelAlias; DataTable Lv2CategoriesInfo = DataQuery.GetSubCategories(Lv2sAlias); DataRow[] Lv2Current = Lv2CategoriesInfo.Select("CategoryAlias = '" + Lv2Alias + "'"); if (Lv2Current.Length > 0) { Lv2CategoriesIndex = Array.IndexOf(Lv2CategoriesInfo.Select("", "XIndex asc"), Lv2Current[0]); } Lv3Navi.DataSource = Lv2CategoriesInfo; Lv3Navi.DataBind(); //主列表 SetAliasAndIsChild(); // if (Request.QueryString["order"] == null) { ListOrder = "desc"; RadioDesc.Checked = true; } else { ListOrder = Request.QueryString["order"].ToString(); switch (ListOrder) { case "asc": RadioAsc.Checked = true; break; case "desc": RadioDesc.Checked = true; break; default: RadioDesc.Checked = true; break; } } // ListType = GetListType(); // string guid = DataQuery.CategoryAliasToID(alias); if (IsChild == "0") { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; } } else { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; } } }
protected void Page_Load(object sender, EventArgs e) { url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; string ChannelTitle = null; // 痕迹&栏目标题 if (Request.QueryString["alias"] == null) { //Response.Redirect("index.aspx"); alias = "gxchannel1_topics_1"; IsChild = "0"; } else { SetAliasAndIsChild(); } string CategoryGUID = DataQuery.CategoryAliasToID(alias); string CategoryPath = DataQuery.CategoryPath(CategoryGUID); char[] PathSeparator = { '/' }; string[] CategoryPaths = CategoryPath.Split(PathSeparator); ChannelAlias = DataQuery.CategoryIDToAlias(CategoryPaths[4]); string Lv2Alias = DataQuery.CategoryIDToAlias(CategoryPaths[6]);//2级分类 ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); CurrentTrace.Text = ChannelTitle; CurrentCategoryName.Text = ChannelTitle; TraceLv2Link.NavigateUrl = "level2.aspx?alias=" + ChannelAlias; //竖导航 String Lv2sAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目"); DataTable Lv2CategoriesInfo = DataQuery.GetSubCategories(Lv2sAlias); DataRow[] Lv2Current = Lv2CategoriesInfo.Select("CategoryAlias = '" + Lv2Alias + "'"); if (Lv2Current.Length > 0) { Lv2CategoriesIndex = Array.IndexOf(Lv2CategoriesInfo.Select("", "XIndex asc"), Lv2Current[0]); } Lv3Navi.DataSource = Lv2CategoriesInfo; Lv3Navi.DataBind(); //主列表 if (Request.QueryString["order"] == null) { ListOrder = "desc"; RadioDesc.Checked = true; } else { ListOrder = Request.QueryString["order"].ToString(); switch (ListOrder) { case "asc": RadioAsc.Checked = true; break; case "desc": RadioDesc.Checked = true; break; default: RadioDesc.Checked = true; break; } } // ListType = GetListType(); // guid = DataQuery.CategoryAliasToID(alias); Lv3Pager.PageSize = int.Parse(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); if (!IsPostBack) { DataTable dt = new DAL.Article().GetArticleList(guid, false, "desc", true); int iTotalRowsCount = dt.Rows.Count; Lv3Pager.RecordCount = iTotalRowsCount; MainDataBind(); } }