Last post Oct 17, 2006 10:38 PM by jeepzj
Oct 14, 2006 03:52 AM|DotnetMaster|LINK
Hi Guys any Idea how to Export A Gridview result to an Image file (such as jpeg or Bitmap file) ?
Thanks In advance
Oct 14, 2006 03:15 PM|pkellner|LINK
when you say gridview result, I usually have images in the gridview with img tags so the gridview never actually sees the jpg. You can certainly use code like the following to extract a jpg from an assembly. The code I'm pasting below is an HttpHandler
that gets the Image data and then displays it like an img tag.
public class CaptchaTypeHandler : IHttpHandler
public void ProcessRequest(HttpContext context)
if (context.Request.QueryString["encryptedvalue"] == null)
// likely, this is in design mode and we want to just show the
// default image for type 2.
Assembly assembly = Assembly.GetExecutingAssembly();
Stream imgStream =
byte ba = new byte[imgStream.Length];
imgStream.Read(ba, 0, Convert.ToInt32(imgStream.Length));
Oct 15, 2006 06:34 AM|DotnetMaster|LINK
Thanks Peter ,
Actually The code you wrote was useful , But I mean I want to Export a Gridview , Just Like Report or something . I mean I want to see the Resultset of a grid in an Image File , Do you Think is that Really Possible ? I want to Fax The Grid Search Result
Thanks in advance
Oct 17, 2006 10:38 PM|jeepzj|LINK
You can use DrawLine method to draw some grids like the source data table by yourselft, then save the image and fax it.