using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class control_newsclass : System.Web.UI.UserControl { public string newsclass = string.Empty; public DataSet dsjsq = Fun.Funjsqid(); public string classid = string.Empty; public int newnum = 0; public string lid = string.Empty; protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["classid"] != null) { classid = Request.QueryString["classid"].ToString(); } string website = Fun.Funnewsclassxml() + "?userid=" + dsjsq.Tables[0].Rows[0]["userid"].ToString() + "&jsqid=" + dsjsq.Tables[0].Rows[0]["jsqid"].ToString() + ""; DataSet ds = new DataSet(); try { ds.ReadXml(website); if (ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string id = ds.Tables[0].Rows[i]["id"].ToString(); string title = Server.UrlDecode(ds.Tables[0].Rows[i]["title"].ToString()); string style = string.Empty; if (id == classid)//判断是否为当前新闻 { style = "class=\"big\""; } newsclass += "
  • " + title + "
  • "; } } } catch { } if (newsclass == "") { newnum = Convert.ToInt32(dsjsq.Tables[0].Rows[0]["newlist"].ToString());//显示条数在peizhi.xml里设置 if (Request.QueryString["lid"] != null) { lid = Request.QueryString["lid"].ToString(); } string website1 = Fun.Funnewslistxml() + "?jsqid=" + dsjsq.Tables[0].Rows[0]["jsqid"].ToString() + "&listnum=" + newnum + ""; try { DataSet dss = new DataSet(); dss.ReadXml(website1); if (dss.Tables.Count > 0) { for (int y = 0; y < dss.Tables[0].Rows.Count; y++) { string name = Server.UrlDecode(dss.Tables[0].Rows[y]["name"].ToString()); string new_proname = Fun.Cutname(name, int.Parse(dsjsq.Tables[0].Rows[0]["listwords"].ToString())); string id = dss.Tables[0].Rows[y]["id"].ToString(); string csid = dss.Tables[0].Rows[y]["classid"].ToString(); string style = string.Empty; if (id == lid) { style = "class=\"big\""; } newsclass += "
  • " + new_proname + "
  • "; } } } catch { } } } }