我用Hashtable存放了书的id和购买的数量,在用datagrid或者用datalist怎么来显示对应书的其它的信息,比如书名,书价等等。
if(Session["bus"]==null)
{
System.Collections.Hashtable ht=new Hashtable();
ht.Add(Bookid,1);
Session["bus"]=ht;
}
else
{
System.Collections.Hashtable ht=(Hashtable)Session["bus"];
if(ht[Bookid]==null)
{
ht[Bookid]=1;
}
else
{
ht[Bookid]=(int)ht[Bookid]+1;
}
Session["bus"]=ht;
if(Session["bus"]==null)
{
System.Collections.Hashtable ht=new Hashtable();
ht.Add(Bookid,1);
Session["bus"]=ht;
}
else
{
System.Collections.Hashtable ht=(Hashtable)Session["bus"];
if(ht[Bookid]==null)
{
ht[Bookid]=1;
}
else
{
ht[Bookid]=(int)ht[Bookid]+1;
}
Session["bus"]=ht;
解决方案 »
- 在 Ajax 的JS代码里怎么打开一个文档???
- 在ado。net中,用executenonquery执行有返回值的存储过程会怎样
- form验证如何限制在浏览器周期范围内?
- 如何解决网站用户的安全信息
- 用VS.net创建web项目时 Web 服务器报告了以下错误http://1.1 500 internal Server Error
- 如何读取动态创建控件里的数据?
- 把数据库中的word文档输出到网页时出现的问题
- 请教一个关于地址栏传递参数的问题
- 急死人了,把图片和它的缩图都存储在ms sql数据库中,显示的时候缩图不能显示。
- image 上传以后 怎样才能 刷新?
- 求国家/城市ID(如中国=CN,广东=12985)和语言ID(如简体中文=2052)等对应表
- 怎么把<-script src=.....js-><-/script-> Render到页面啊?
海峰(236881222) 12:56:39
string Bookid=Request["id"].ToString();
if(!this.IsPostBack)
{
Response.Write(Request["id"].ToString());
if(Session["bus"]==null)
{
System.Collections.Hashtable ht=new Hashtable();
ht.Add(Bookid,1);
Session["bus"]=ht;
}
else
{
System.Collections.Hashtable ht=(Hashtable)Session["bus"];
if(ht[Bookid]==null)
{
ht[Bookid]=1;
}
else
{
ht[Bookid]=(int)ht[Bookid]+1;
}
Session["bus"]=ht;
}
this.DataList1.DataSource=(Hashtable)Session["bus"];
this.DataList1.DataBind();
我用hashtable把书的ID和购买的数量都能取出来了,可以怎么样才能取出对应的书的其它信息,请各位帮忙, 不用datagrid来显示