Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi I have user profiles on my project,
There is a selection of photos in profile,

My question:
When the user selects a photo(User Photo)should be displayed on all pages of his
But I do not know how to do it
Please help me
Posted
Comments
Denis Shemenko 8-Jul-13 0:08am    
Absolutely unclear question...
What profiles?
What pages?
What you want??

1 solution

Hi,

I guess, you are storing image url's in database.

Call this method in page load of every page where you want photo.and also write code for getphotos() method.
C#
public void BindMemberPhotos()
   {

       DataSet dsPhotos = user.GetPhotos();
       if (Convert.ToString(dsPhotos.Tables[0].Rows[0]["Photo"]) != null && Convert.ToString(dsPhotos.Tables[0].Rows[0]["Photo"]) != "")

       {
           imgPhoto.Visible = true;
           imgPhoto.ImageUrl =  dsPhotos.Tables[0].Rows[0]["Photo"].ToString();
       }
       else
       {
          imgPhoto.Visible = true;
          imgPhoto.ImageUrl="~/images/NoImage.jpg";
       }
   }
 
Share this answer
 
Comments
nazanin6868 8-Jul-13 7:50am    
Thanks,
I think,I did not express my question well.
I've used in my project property profile,
I've defined the variables in web.config :

<profile>
<properties>
<add name="firstname">
<add name="lastname">
<add name="address">
<add name="LastActivityDate" type="System.DateTime">
<add name="Avatar">

</properties>
</profile


In page profile.aspx, I did retrieve and store the variables

Code behind:
protected void BtnInsertProf_Click(object sender, EventArgs e)
{
if (!Profile.IsAnonymous)
{
Profile.firstname = TxtName.Text;
Profile.lastname = TxtFamily.Text;
Profile.address = TxtAdres.Text;
Profile.LastActivityDate = DateTime.Now;
Profile.Avatar = ImageProfile.ImageUrl;



}
}

On the page profile.aspx, there are tools for photo, upload photo that user select photo

All this is true.
My question:
I would image that the user has chosen on this page should be displayed on all pages
nazanin6868 9-Jul-13 2:18am    
My problem was resolved
Thanks

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