Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to display image on image button control.getting the path from the database

Here i am saving the photo in database successfully.what i am facing is to display that photo on the image button control.
can any one help fast..
Posted
Updated 20-Dec-12 1:29am
v2

C#
string SelStr = "select * from Users";
SqlDataAdapter da = new SqlDataAdapter(SelStr, con);
DataTable dt = new DataTable();

da.Fill(dt);

foreach(DataRow dr in dt.Rows)
{
    ImageCtrl.ImageUrl = dr["ImagePath"].ToString();
}

Try if it works.. just my blind assumption..
 
Share this answer
 
v2
Comments
ntitish 20-Dec-12 7:18am    
actually i want to display the image accordingly to login_id.
if the particular login person is having the image means it should display on the image. not the image button i posted wrongly....
[no name] 20-Dec-12 7:20am    
please correct your question first... I'm updating my solution..
ntitish 20-Dec-12 7:19am    
image control not the image button control...
ntitish 20-Dec-12 7:23am    
sir if u dont mind i am not getting the update button on this page...can u update the question....actually i am trying from last 10 min.....
[no name] 20-Dec-12 7:25am    
" Improve Question " use it
 
Share this answer
 
imgDisplayPhoto.ImageUrl = ViewState["Photo_Path"].ToString();

directly we can give the path of the photo which is saving in the database.

thanks for every one who spended their valuable time for me....
 
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