在asp.net的gridview中动态更改图像

问题描述:

大家好,

我有一个gridview,其中有一个imagebutton列,我使用gridview_RowDataBound事件从sql中存储在表中的路径动态绑定此图像列和图像.

但是现在当我单击imagebutton时,将一些参数传递给sql并更改了图像的路径,现在我想要的是通过再次获取图像的路径来更新网格视图imagebutton的图像.

请帮我如何实现这个目标!


问候,
Krunal Panchal

Hello Everyone,

I have one gridview, in which there is one imagebutton column , i bind this image column dynamically with images using gridview_RowDataBound Event from the path stored in table in sql.

But now when i click the imagebutton click some parameters are passed to sql and the path of the image is changed, now what i want is by again fetching the path of the image i want to update the image of the imagebutton of gridview.

Please help me how can i achieve this!!


Regards,
Krunal Panchal

在单击imagebutton时使用ItemCommand 事件.
ItemCommand 事件中..

Use the ItemCommand event when you click the imagebutton.
In ItemCommand event..

dim imgButton as ImageButton
imgButton = ctype(sender,ImageButton)
 
' Pull your image path from sql store it in a string lsPath
 
imgButton.ImageUrl = server.mappath(lsPath)





-就是这样..希望对您有帮助..





--Thats it.. hope it helps you..