Click here to Skip to main content
15,895,962 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am using Asp.net C# . I have filled gridView with images from database datatype Varbinary(Max). Now what i want is when i click on image name in datagrid it Display image in a popwindow or in new window....


Please Help me..................
Posted

1 solution

C#
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
   {

       try
       {
           switch (e.CommandName)
           {
               case "view":

                   string name = e.CommandArgument.ToString();
                   String js = "window.open('OpenPDF.aspx?id=" + name + "', '_blank');";


                  
                   ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Welcome", js, true);
                   break;

           }
       }
       catch (Exception ex)
       {


       }

   }
 
Share this answer
 
Comments
Member 11014751 5-Sep-14 8:03am    
Error on Script manager Error:The name 'ScriptManager' does not exist in the current context.

i have loded grid by sqlDatasource
vr reddy 5-Sep-14 8:07am    
use below name space

using System.Web.UI;
Member 11014751 5-Sep-14 8:08am    
Its already There
vr reddy 5-Sep-14 8:12am    
please send me your line
Member 11014751 5-Sep-14 8:12am    
protected void GVPhotos_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
switch (e.CommandName)
{
case "view":

string filename = e.CommandArgument.ToString();
String js = "window.open('Picture.aspx?ID=" + filename + "', '_blank');";
ClientScript.RegisterClientScriptBlock(this, this.GetType(), "Welcome", js, true);
break;

}
}
catch (Exception ex)
{

}
}

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