protected void Page_Load(object sender, EventArgs e) { url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; string ChannelAlias = Request.QueryString["alias"].ToString(); string ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); // 推荐 String CommendAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "推荐"); string CommendGuid = DataQuery.CategoryAliasToID(CommendAlias); DataTable CommendCourses = new DAL.Article().GetArticleList(CommendGuid, false, 12); CommendList.DataSource = CommendCourses; CommendList.DataBind(); //排行 //DataTable HotListDataSrc = DataQuery.GetHotList(); //HotList.DataSource = HotListDataSrc; //HotList.DataBind(); // 主列表 String CategoryLv2Alias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目"); string Version = ConfigurationManager.AppSettings["Version_Mark"]; DataTable GetSubCategories = DataQuery.GetSubCategoriesApart(CategoryLv2Alias, Version); Level2MainRight.DataSource = GetSubCategories; Level2MainRight.DataBind(); Image Level2MainBanner = (Image)FindControl <Image>("Level2MainBanner"); Level2MainBanner.ImageUrl = "images/AD" + ChannelAlias + ".gif"; //LeftPic LeftPicAliasText = ConfigurationManager.AppSettings["ChannelPicCategory"]; LeftPicLv2AliasText = DataQuery.GetChannelAliasByName(LeftPicAliasText, ChannelTitle); Level2LeftPicBot.ImageUrl = "ShowBytePic.aspx?Title=底部图片&Alias=" + LeftPicLv2AliasText; int LeftPicCount = (GetSubCategories.Rows.Count - 6) / 2; String LeftPicAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "图片专题"); DataTable LeftPicGetSubCategories = DataQuery.GetSubCategories(LeftPicAlias, LeftPicCount.ToString()); LeftPicList.DataSource = LeftPicGetSubCategories; LeftPicList.DataBind(); //Level2LeftPic1.ImageUrl = "images/" + ChannelAlias + "_1.jpg"; //int SubCategoriesCount = GetSubCategories.Rows.Count; //if (SubCategoriesCount >= 10) //{ // Level2LeftPic2.Visible = true; // Level2LeftPic2.ImageUrl = "images/" + ChannelAlias + "_2.jpg"; //} //if (SubCategoriesCount >= 12) //{ // Level2LeftPic3.Visible = true; // Level2LeftPic3.ImageUrl = "images/" + ChannelAlias + "_3.jpg"; //} //if (SubCategoriesCount >= 14) //{ // Level2LeftPic4.Visible = true; // Level2LeftPic4.ImageUrl = "images/" + ChannelAlias + "_4.jpg"; //} }
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[6]);//2级分类 ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); //CurrentTrace.Text = ChannelTitle; CurrentCategoryName.Text = ChannelTitle; //TraceLv2Link.NavigateUrl = "level2.aspx?alias=" + ChannelAlias; //竖导航 String Lv2sAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目"); string Version = ConfigurationManager.AppSettings["Version_Mark"]; DataTable Lv2CategoriesInfo = DataQuery.GetSubCategoriesApart(Lv2sAlias, Version); 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(); // 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 ChannelAlias = ""; string ChannelTitle = ""; try { ChannelAlias = Request.QueryString["alias"].ToString(); } catch { ChannelAlias = "gxchannel1"; } ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); // 推荐 String CommendAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "推荐"); string CommendGuid = DataQuery.CategoryAliasToID(CommendAlias); DataTable CommendCourses = new DAL.Article().GetArticleList(CommendGuid, false, 12); CommendList.DataSource = CommendCourses; CommendList.DataBind(); //排行 //DataTable HotListDataSrc = DataQuery.GetHotList(); //HotList.DataSource = HotListDataSrc; //HotList.DataBind(); // 主列表 String CategoryLv2Alias = DataQuery.GetChannelAliasByName(ChannelAlias, "栏目"); string Version = ConfigurationManager.AppSettings["Version_Mark"]; DataTable GetSubCategories = DataQuery.GetSubCategoriesApart(CategoryLv2Alias, Version); // Level2MainRight.DataSource = GetSubCategories; // Level2MainRight.DataBind(); // Image Level2MainBanner = (Image)FindControl<Image>("Level2MainBanner"); //Level2MainBanner.ImageUrl = "images/AD" + ChannelAlias + ".gif"; //LeftPic LeftPicAliasText = ConfigurationManager.AppSettings["ChannelPicCategory"]; LeftPicLv2AliasText = DataQuery.GetChannelAliasByName(LeftPicAliasText, ChannelTitle); //Level2LeftPicBot.ImageUrl = "ShowBytePic.aspx?Title=底部图片&Alias=" + LeftPicLv2AliasText; //int LeftPicCount = (GetSubCategories.Rows.Count - 6) / 2; int LeftPicCount = 1; String LeftPicAlias = DataQuery.GetChannelAliasByName(ChannelAlias, "图片专题"); DataTable LeftPicGetSubCategories = DataQuery.GetSubCategories(LeftPicAlias, LeftPicCount.ToString()); LeftPicList.DataSource = LeftPicGetSubCategories; LeftPicList.DataBind(); //Level2LeftPic1.ImageUrl = "images/" + ChannelAlias + "_1.jpg"; //int SubCategoriesCount = GetSubCategories.Rows.Count; //if (SubCategoriesCount >= 10) //{ // Level2LeftPic2.Visible = true; // Level2LeftPic2.ImageUrl = "images/" + ChannelAlias + "_2.jpg"; //} //if (SubCategoriesCount >= 12) //{ // Level2LeftPic3.Visible = true; // Level2LeftPic3.ImageUrl = "images/" + ChannelAlias + "_3.jpg"; //} //if (SubCategoriesCount >= 14) //{ // Level2LeftPic4.Visible = true; // Level2LeftPic4.ImageUrl = "images/" + ChannelAlias + "_4.jpg"; //} String CategoryGUID = ""; string TraceText = ""; if (Request.QueryString["id"] == null) { CategoryGUID = "1c68f666dc914382b95456acf6be87a5"; } else { CategoryGUID = Request.QueryString["id"].ToString(); } char[] PathSeparator = { '/' }; string CategoryPath = DataQuery.CategoryPath(CategoryGUID); string[] CategoryPaths = CategoryPath.Split(PathSeparator); for (int i = 4; i < CategoryPaths.Length; i++) { string title = DataQuery.GetNameByCategoryID(CategoryPaths[i]); TraceText += title + " / "; } Trace.Text = TraceText; }