R
Raghu Raman
Hi,
I want to load the images from my sqlserver200 db to the datagrid.I've
seen a code from odetocode.com and it recreated to my wish.
Database : Northwind;Table : from Employees , i want to take only
employeeid,photo to the grid.
html code for Datagrid..
<Columns>
<asp:BoundColumn DataField="employeeid"
HeaderText="EmployeeId"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Picture">
<ItemTemplate>
<img runat ="server" src ='<%# "WebGridPture.aspx?IDS=" +
DataBinder.Eval(Container.DataItem,"EmployeeId") %> ' ID ="Img1"/>
</ItemTemplate>
</asp:TemplateColumn></Columns>
</asp:datagrid></form>
------------------------------------pageload code------------------
database connection and grid fillings and the grid displays with the
empty images, quite natual since no byte conversion.But in a button a
've the following code to get the image to the grid.
--------------------button code-------------------------------------
string employeeid = Request.QueryString["IDS"].ToString(); //** object
ref not allowed to an instance of an object * error *//
Dr=cmd.ExecuteReader();
Dr.Read();
byte[] bytearray=(byte[]) Dr["photo"];
Response.BinaryWrite(bytearray);
---------------------------------
let us assume that the DBconnection is good.
I am bit confused , how the query string gets the value for all the
records. and where the datasource for the grid ,i also get the errors.
Could u please tell the mistake on these or if u provide a better code ,
it would be great .
Thanks in advance
Raghuraman
I want to load the images from my sqlserver200 db to the datagrid.I've
seen a code from odetocode.com and it recreated to my wish.
Database : Northwind;Table : from Employees , i want to take only
employeeid,photo to the grid.
html code for Datagrid..
<Columns>
<asp:BoundColumn DataField="employeeid"
HeaderText="EmployeeId"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Picture">
<ItemTemplate>
<img runat ="server" src ='<%# "WebGridPture.aspx?IDS=" +
DataBinder.Eval(Container.DataItem,"EmployeeId") %> ' ID ="Img1"/>
</ItemTemplate>
</asp:TemplateColumn></Columns>
</asp:datagrid></form>
------------------------------------pageload code------------------
database connection and grid fillings and the grid displays with the
empty images, quite natual since no byte conversion.But in a button a
've the following code to get the image to the grid.
--------------------button code-------------------------------------
string employeeid = Request.QueryString["IDS"].ToString(); //** object
ref not allowed to an instance of an object * error *//
Dr=cmd.ExecuteReader();
Dr.Read();
byte[] bytearray=(byte[]) Dr["photo"];
Response.BinaryWrite(bytearray);
---------------------------------
let us assume that the DBconnection is good.
I am bit confused , how the query string gets the value for all the
records. and where the datasource for the grid ,i also get the errors.
Could u please tell the mistake on these or if u provide a better code ,
it would be great .
Thanks in advance
Raghuraman