/// <summary>
/// 一级地区
/// </summary>
/// <param name="pid"></param>
/// <returns></returns>
protected void diquBind(int pid)
{
secondDiqu = qd8.BLL.diqu.getbieming(pid);//获取地区别名
string cacheKey = "cache" + pid;
StringBuilder firstlist = new StringBuilder("");
DataSet ds = null;
//qd8.DBUtility.DataCache.RemoveCache(cacheKey);
object obj = qd8.DBUtility.DataCache.GetCache(cacheKey);
if (obj != null)
{
Hashtable ht = (Hashtable)obj;
StringBuilder tem = new StringBuilder("");
foreach (DictionaryEntry item in ht)
{
string[] teStr = item.Value.ToString().Split('_');
string te = item.Key.ToString() == ViewState["dq"].ToString() ? "style=/"color:#ff0000;/"" : "";
tem.Append("<a " + te + " href=/"/" + menuName + "/" + item.Key + "/" + url + "//">" + teStr[0] + "</a> ");
}
ltl_s_city.Text = tem.ToString();
}
else
{
ds = qd8.BLL.diqu.diqufenlei(pid.ToString());//根据父类id 获取该分类下子类列表
if (ds.Tables[0].Rows.Count > 0)
{
Hashtable ht = new Hashtable();
foreach (DataRow row in ds.Tables[0].Rows)
{
string tempStr = row["title"] +"_"+ "0";//0否 1是 加红
ht.Add(row["directory"].ToString(), tempStr);
}
qd8.DBUtility.DataCache.SetCache(cacheKey, ht);
this.ltl_s_city.Text = "<a style=/"color:#ff0000;/" href=/"/" + menuName + "/" + secondDiqu + "/" + url + "//">不限</a> " + firstlist.ToString() + dq.ToString();
}
}
}
hashtable 用法
最新推荐文章于 2019-09-28 10:12:57 发布