how to display an alternate image when original image is not uploaded in asp.net.
How to display an alternate image when original image is not uploaded or missing in asp.net,c#.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
R ACHUTHAPosted Oct 11, 2012, 4:54 AM
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Image CurrentImage = (Image)e.Row.FindControl("imgLogo");
if (!File.Exists(Server.MapPath(CurrentImage.ImageUrl)))
{
// if image not exists, use default image
CurrentImage.ImageUrl = "~/Images/DefaultImage.gif";
}
}
}
refer
http://www.beansoftware.com/ASP.NET-Tutorials/Image-Not-Found-GridView.aspx
Sivaraman DhamodaranPosted Oct 11, 2012, 4:51 AM
You can use this in asp.net