Click here to Skip to main content
15,907,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Anyone has any idea how to display image in another page after double click on specific record in gridview?

Thanks!
Posted
Comments
sahabiswarup 28-Nov-12 0:53am    
while click on the grid you can easily fetch the ID of that particular row and then redirect the page and display that particular row image using that ID.

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.
 
Share this answer
 
I solved it by

C#
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900