Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
I have images in a folder.
The employee information in the database in one table.
The employees picture information in another table.

I need to show both of them at once in asp:gridview using c#.

I am able to do the either thing only, not the both at the same time.

So, how to do this?
Posted
Comments
Nandakishore G N 10-Jun-13 7:54am    
what have you done till now paste it? it can be done join two tables and call it in the datatable even the path comes and then bind it to the gridview.

Save your Images into a folder with a reference from the database field.

Like : img_id.jgg / [ img_1.jpg , img_2.jpg, img_3.jpg]

Then get all data from the table and build your image path for each row


DataTable dt = sql.ExecuteDataTable("sp_MyProc");

dt.Columns.Add("MyImagePath", type(System.String));

foreach(DataRow dr in dt.Rows)
{
//need to set value to MyRow column
dr["MyImagePath"] = "/FolderName/"+img_+dr["Id"]+.jpg;
}

Hope this will work for you
 
Share this answer
 
 
Share this answer
 

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