帮我解决下dataset绑定连接问题?

loveflydhl 2009-04-08 02:13:37
我的datalist 里面放了个图片控件 用于显示图片

从数据库查了两个字段 imaName 和 imgPath 出来。。。在 绑定到datalist之前 对查出的imgPath进行了缩略图处理,

我再把 缩略图的新路径替换了原先的imgPath,现在图片显示的都是缩略图的效果了。但我要点击图片显示图片原图,这就要原图的路径了,如果我再帮imgPath的话就不行了。。
string source = ds.Tables[0].Rows[i]["imgpath"].ToString();

string small = Server.MapPath("./minImag/Min_cd_info" +ds.Tables[0].Rows[i]["id"].ToString()+type);

images.MakeThumbnail(source, small, 131, 119);缩略图处理

ds.Tables[0].Rows[i]["path"] =small;缩略图地址绑定到imgpath

我就想问问 有什么办法dataset 把原图的路径也保存上???
或者可以用什么方法让图片显示的是缩略图,点击图片连接的地址是原图的???
...全文
84 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿非 2009-04-08
  • 打赏
  • 举报
回复

ds.Tables[0].Rows[i]["path"] =ds.Tables[0].Rows[i]["path"].ToString()+"," +small;

同时存原图路径与略缩图路径

取的时候ToString().Split(',')[0]为原图
ToString().Split(',')[1]为略缩图
sjlianan 2009-04-08
  • 打赏
  • 举报
回复
up
loveflydhl 2009-04-08
  • 打赏
  • 举报
回复
顶贴有分。。
loveflydhl 2009-04-08
  • 打赏
  • 举报
回复
ds.Tables[0].Rows[i]["path"] =small; 写错就是 ds.Tables[0].Rows[i]["imgpath"] = small

缩图替换了查出的地址。。。

我找了个方法了 用了个imagebutton 点击 其中一个图片获得id后再查原图地址
mykelly6 2009-04-08
  • 打赏
  • 举报
回复
看看有没有tag属性之类的,保存在这里面啊。
genius_tong 2009-04-08
  • 打赏
  • 举报
回复
UP~
txt_paul 2009-04-08
  • 打赏
  • 举报
回复
友情一顶
阿非 2009-04-08
  • 打赏
  • 举报
回复
可以用什么方法让图片显示的是缩略图,点击图片连接的地址是原图的???
--------------------------------------------


<img src='<%#Eval("略缩图path")%>' onclick=<%"this.src='"+#Eval("原图path").ToString()+"';"%> />
阿非 2009-04-08
  • 打赏
  • 举报
回复

string source = ds.Tables[0].Rows[i]["imgpath"].ToString();

string small = Server.MapPath("./minImag/Min_cd_info" +ds.Tables[0].Rows[i]["id"].ToString()+type);

images.MakeThumbnail(source, small, 131, 119);缩略图处理

ds.Tables[0].Rows[i]["path"] =small;缩略图地址绑定到imgpath



ds.Tables[0].Rows[i]["imgpath"] 与 ds.Tables[0].Rows[i]["path"] ?
你现在不已经是 两个路径了么?

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧