在GridView中显示可点击的图像 [英] displaying clickable images in gridview

查看:87
本文介绍了在GridView中显示可点击的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在asp.net中使用gridview在页面上显示存储在文件夹中的可单击图像和来自sql server之类的数据库中的图像信息数据? IRFAN3132!

您必须在GridView的 RowDataBound 事件中执行此操作

( http://msdn.microsoft.com/en-us /library/system.web.ui.webcontrols.gridview.rowdatabound.aspx [ " html标记放在图像之前和之后的逻辑.

标记中,您可以从"target"属性中进行选择,或者使用"onclick"属性来调用jQuery/javascript.

另一种方法是将ImageButton放入网格并将其绑定.但是,点击后您将获得回发.

希望对您有所帮助.
再见


How can i display clickable images stored in a folder and image information data from a database like sql server on a page using gridview in asp.net

解决方案

Hi IRFAN3132!

you have to do this at the RowDataBound event of your GridView

( http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx[^] )

This event are called for every row in the datasource.

There insert the logic to put "" html tags before and after of your image.

At the tag you can choice from the "target" attribute or call a jQuery/javascript with the "onclick" attribute.

Other way is to put an ImageButton into the grid and bind it. But you will get a postback at click.

I hope this help.
bye


这篇关于在GridView中显示可点击的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆