protected void Page_Load(object sender, EventArgs e) { hkdb.VeriSess("4"); if (Request.QueryString["typeId"] != null) { strtypeid = "&typeId=" + Request.QueryString["typeId"] + ""; strsql = " and FoldersID = '" + hkdb.GetStr(Server.UrlDecode(Request.QueryString["typeId"])) + "'"; } else { strtypeid = ""; strsql = ""; } if (!IsPostBack) { hkdb.PassTo("11310", "0"); if (Request.QueryString["typeId"] != null) { SqlDataReader dr = SqlHelper.ExecuteReader("select * from hk_Ygtxl_lb where id='" + int.Parse(Request.QueryString["typeid"]) + "' "); if (dr.Read()) { Namefile = dr["name"].ToString(); } else { Namefile = "未选择类别"; } dr.Close(); } else { Namefile = "未选择类别"; } BindAttr(); AspNetPager1.PageSize = int.Parse(Request.Cookies["haoke"].Values["pagecount"]); //页面绑定 GridViewBind(); } XMStr = null; SqlDataReader dr_jy = SqlHelper.ExecuteReader("select distinct substring(dbo.fun_getPY(name),1,1) as FYNAME from hk_Ygtxl"); while (dr_jy.Read()) { string SQL_GetCount = "select count(id) from hk_Ygtxl where substring(dbo.fun_getPY(name),1,1)='" + dr_jy["FYNAME"] + "'"; string XMCount = "" + hkdb.GetCount(SQL_GetCount) + ""; XMStr += "<a href='ygtxl_r.aspx?XS=" + dr_jy["FYNAME"] + "" + strtypeid + "' class=gvlink>" + dr_jy["FYNAME"] + "(" + XMCount + ")</a> "; } dr_jy.Close(); }