How to replace cross mark image in C#

Posted by Chitrasathiya under C# on 3/16/2010 | Views : 2918 | Status : [Member] | Replies : 1
I have so many images in my image folder eg of images: Admin1, Admin2, Admin3, Admin4 etc...
I am passing the value from db as 1,2,3,4 etc...
I have written the below code.
string aa = "1";// These value is coming from table(DB)
Image1.ImageUrl = "~/images/"+"admin" + aa+ ".gif";
If i have admin1 image, then that image is coming.
If i dont have admin2 image, Then Cross mark image is coming.
Instead of that i have to replace another image which is availbel in my image folder.
Can anyone pls help me how to do this in c#...


Posted by: Abhi2434 on: 3/16/2010 [Member] [Microsoft_MVP] [MVP] Silver

Create an Image IHttpHandler.

From the image handler Read the image using Filestream and write in Output stream.

If you dont find it, Transmit your own error file.

Chitrasathiya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response