双击gridview后,在另一页中显示图像c# [英] Display image in another page after double click on gridview c#

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

问题描述



任何人都知道如何在双击gridview中的特定记录后如何在另一页中显示图像?



谢谢!

解决方案

如果你想在弹出窗口中显示图像而不想要服务器端调用,那么你可以在每个行中注册脚本(clientscript。 registertartupscript)当行创建并在该脚本中你可以调用javascript函数,它将获取id并打开图像。


我解决了它



  protected   void  GridView1_RowDataBound( object  sender,GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes.Add( oncl ick javascript:window.location.href ='ViewImage.aspx?ID = + e.Row.Cells [ 0 ]。文本+ ';);
}

}





请记住将OnRowDataBound =GridView1_RowDataBound放入您的aspx源代码中。


Hi,
Anyone has any idea how to display image in another page after double click on specific record in gridview?

Thanks!

解决方案

If you want to show Image in pop up and don''t want server side call, in that scenario you can register script with each row (clientscript.registerstartupscript) while row create and in that script you can call javascript function which will take id and open Image according to that.


I solved it by

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
   {

       if (e.Row.RowType == DataControlRowType.DataRow)
       {

                     e.Row.Attributes.Add("onclick", "javascript:window.location.href ='ViewImage.aspx?ID=" + e.Row.Cells[0].Text + "';");
       }

   }



Remember to put OnRowDataBound ="GridView1_RowDataBound" into your aspx source.


这篇关于双击gridview后,在另一页中显示图像c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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