How to show a default photo.
-
Hi all, I want to display employee photo whenever he logs in. I am not storing the url of photo in database instead i have created a folder in which the photo is saved with empid name.I want that if the photo doesn`t exist a default pic to be shown.If the photo exists in the folder,the pic be shown. how do i achieve this. Thankx in advance.
-
Hi all, I want to display employee photo whenever he logs in. I am not storing the url of photo in database instead i have created a folder in which the photo is saved with empid name.I want that if the photo doesn`t exist a default pic to be shown.If the photo exists in the folder,the pic be shown. how do i achieve this. Thankx in advance.
-
Hi all, I want to display employee photo whenever he logs in. I am not storing the url of photo in database instead i have created a folder in which the photo is saved with empid name.I want that if the photo doesn`t exist a default pic to be shown.If the photo exists in the folder,the pic be shown. how do i achieve this. Thankx in advance.
hi let us say u have an image object. it has a property imageurl which u can set at runtime. since u r knowing the empid of the user logging in its easy for u to trace the imagename from the source directory. the only thing u have to check whether the image exists r not. try this and see. if it has any prob let me know for further asst.
-
hi let us say u have an image object. it has a property imageurl which u can set at runtime. since u r knowing the empid of the user logging in its easy for u to trace the imagename from the source directory. the only thing u have to check whether the image exists r not. try this and see. if it has any prob let me know for further asst.
Where`s the code??? I just want to check whether the photo exists or not.What happens is i set the URL as IMG1.Src="c:\\"+empid+".jpg" .But if the photo is not present it displays nothing(it`s obvious).What to do???
-
Where`s the code??? I just want to check whether the photo exists or not.What happens is i set the URL as IMG1.Src="c:\\"+empid+".jpg" .But if the photo is not present it displays nothing(it`s obvious).What to do???
-
Prior to set the src to the image you need to search for the image. This you can do with simple file handling objects.
Best Regards, Apurva Kaushal
Sorry,but i have no knowledge of handling files. Can u give me the code .. Please..
-
Sorry,but i have no knowledge of handling files. Can u give me the code .. Please..
-
Where`s the code??? I just want to check whether the photo exists or not.What happens is i set the URL as IMG1.Src="c:\\"+empid+".jpg" .But if the photo is not present it displays nothing(it`s obvious).What to do???
-
Hi all, I want to display employee photo whenever he logs in. I am not storing the url of photo in database instead i have created a folder in which the photo is saved with empid name.I want that if the photo doesn`t exist a default pic to be shown.If the photo exists in the folder,the pic be shown. how do i achieve this. Thankx in advance.
i have pasted a sample code. here label1.text stands for ur empid iam using a image server control i created a folder in the app path named photo where i stored my sample pics this is how i accessed and set the object. i hope u can modify further acc to ur reqts. Dim s As String = CurDir() Dim s1 As String = s & "\Photo" Dim s2() As String Dim s3 As String Dim i As Integer Dim j As Integer Label1.Text = "yasoda2" If Directory.Exists(s1) Then s2 = Directory.GetFiles(s1) For i = 0 To s2.Length() - 1 j = s2(i).IndexOf(".") s3 = Left(s2(i), j) If (s3 = s1 & "\" & Label1.Text) Then Image1.ImageUrl = s2(i).Replace(s, "~") End If Next Else Console.Write("Directory dose not exist") End If
-
You can use System.IO.File.Exists("path") to check whether file exists or not.
Best Regards, Apurva Kaushal
Thanks it`s working!!!
-
Thanks it`s working!!!