Click here to Skip to main content
12,897,830 members (65,005 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
Up to uploading the profile pic i have completed but i am facing problem in uploading default profile pic when the user not uploaded his profile pic

//below is my code for upload profile pic
if (UploadPhoto.HasFile)
string UploadFolderPath = "Profile_Pic\\" + txtChildName.Text + "_";
UploadFolderPath = UploadFolderPath + UploadPhoto.FileName;
if (UploadFolderPath.ToLower().EndsWith(".jpg"))
cmdAdmission.Parameters.Add(new SqlParameter("@Photo_Path", SqlDbType.NVarChar,200));
cmdAdmission.Parameters["@Photo_Path"].Value = UploadFolderPath;
//here i have to take default Profile Pic
Posted 20-Feb-13 20:48pm
Updated 20-Feb-13 21:17pm
maxrockM 21-Feb-13 3:21am
If you want to show some default image for profile pic, you might as well place the default image in the images folder and during loading, check whether the user has a pic uploaded or not and if he does not have a pic then just show the image which is in the image folder. Will this not work for you?
ntitish 21-Feb-13 3:31am
ntitish 21-Feb-13 7:15am
i am unable to display while picking from database

//here is my code for displaying the image
imgbtnProfilePic.ImageUrl = ViewState["Photo_Path"].ToString();
imgbtnProfilePic.ToolTip = name;
ntitish 21-Feb-13 7:22am
sir i am getting......thanks

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


string defaultpic="shadowimage.jpg";

sqlcomm.Parameters.Add("@profilepic", SqlDbType.VarChar, 200).Value = defaultpic;

In Profilepic folder add this shadowimage.jpg then

on welcome page Image1.ImageUrl="Profilepic\\"+dr["pic"].ToString()
show that pic if user did not upload his pic.
ntitish 21-Feb-13 3:32am
Surendra0x2 21-Feb-13 3:36am
Nitish if u found my answer helpful then accept it :) thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100