<asp:TemplateField> <ItemTemplate> <asp:Image runat="server" ID="grdvwimg" ImageUrl='<%#"ModelHandler.ashx?id="+Eval("mdl_id")%>' Height="150px" Width="150px" /> </ItemTemplate>
public void bind() { cmd = new SqlCommand(); con = new SqlConnection(strConnString); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Flag", 13); cmd.CommandText = "StoreProcedureSelect"; cmd.Connection = con; try { con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); grdvwModel.DataSource = ds; grdvwModel.DataBind(); } catch (Exception ex) { throw ex; } }
<pre> public void ProcessRequest(HttpContext context) { try { con = new SqlConnection(strConnString); string imageid = context.Request.QueryString["id"]; SqlCommand command = new SqlCommand("SELECT mdlimg FROM Model WHERE mdl_id = 'imageid'", con); con.Open(); SqlDataReader dr = command.ExecuteReader(); dr.Read(); context.Response.BinaryWrite((Byte[])dr[0]); context.Response.End(); } catch (Exception ex) { throw ex; } } public bool IsReusable { get { return false; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)