public string bind()
{
string SQLString = "select type,cid from workscid";
DB db = new DB();
DataSet ds = db.MySqlDataSet(SQLString);
StringBuilder str = new StringBuilder();
if (ds.Tables[0].Rows.Count > 0)
{
int i = 1;
foreach (DataRow dr in ds.Tables[0].Rows)
{
string s = @"<li><a href='chanpin.aspx?cid={cid}'>{type}</a></li>
<div class='pane'>
{content}
</div>";
string SQLString2 = "select title,cid,id from works where cid=" + dr["cid"].ToString();
DataSet ds2 = db.MySqlDataSet(SQLString2);
StringBuilder str2 = new StringBuilder();
if (ds2.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr2 in ds2.Tables[0].Rows)
{
string ss = @"<a href='chanpin.aspx?cid={cid}&cid2={cid2}' {class}{i}>{title}</a>";
if (dr2["id"].ToString() == Request.QueryString["cid2"])
{
ss = ss.Replace("{class}", "class='on'");
}
else { ss = ss.Replace("{class}", ""); }
if (Request.QueryString["cid2"] == null && i == 1)
{
ss = ss.Replace("{i}", "class='on'");
}
else { ss = ss.Replace("{i}", ""); }
ss = ss.Replace("{title}", dr2["title"].ToString());
ss = ss.Replace("{cid}", dr2["cid"].ToString());
ss = ss.Replace("{cid2}", dr2["id"].ToString());
str2.Append(ss);
i++;
}
}
s = s.Replace("{content}", str2.ToString());
s = s.Replace("{type}", dr["type"].ToString());
s = s.Replace("{cid}", dr["cid"].ToString());
str.Append(s);
}
}
return str.ToString();
}