Hi,
I am trying to put picture in GridView from SQL Server 2000 Database using Employees Table.
I am using ASP.NET 2.0.. I created typed dataSet selecting all columns. Among all columns, one of them is picture column......
I tried with ImageBound column, it did not work......
Can anyone help please..
Thanks
Basheer NassrallahPosted Oct 4, 2006, 10:02 AM
Are you saving the Image files in a certain folder and keeping a track of the filenames in the DB?
if so you can try adding a template column to the GridView, insert an image control into it, and edit it's data binding to the following:
Bind the ImageUrl to this function using Custom Binding :
Bind_Image(Container,"DataItem.EmployeeID")
add a server-side method to the webpage as following:
public string Bind_Image(object X,string Y)
{
string EmployeeID=DataBinder.Eval(X,Y);
/*Now you have the employee's ID so you can pull the image file path from another table if you need so, you can change the binding to Bind_Image(Container,"DataItem.ImagePath") in order to get the path directly*/
string ImagePath;
//pull the path from any table and and store it in the ImagePath
return "~\\ImageFolder\\"+ImagePath;
}
Dipal ChoksiPosted Sep 30, 2006, 11:21 PM
What are the details of the error you are getting?