protected void Page_Load(object sender, EventArgs e) { GetUserName(); if (!IsPostBack) { user.Text = Session["username"].ToString(); string username = user.Text; string pathFromDB = Usr.GetProfilePicture(Session["userid"].ToString()); string usrphoto = Server.MapPath("./") + pathFromDB; if (pathFromDB != null && System.IO.File.Exists(usrphoto)) { photo.ImageUrl = pathFromDB; } else { photo.ImageUrl = Usr.defaultUserPhoto; } string userid = Session["userid"].ToString(); int numberOfMssg = Usr.NumberOfNotifications(userid); if (numberOfMssg > 0) { Label myLabel = this.FindControl("NowaWiadomosc") as Label; myLabel.Text = numberOfMssg.ToString(); } Label OdwiedziliTotal = this.FindControl("OdwiedziliTotal") as Label; Label OdwiedziliNew = this.FindControl("OdwiedziliNew") as Label; if (GetNumberOfNewVisits() == 0) { OdwiedziliNew.Visible = false; } else { OdwiedziliNew.Text = GetNumberOfNewVisits().ToString() + "/"; } OdwiedziliTotal.Text = Usr.GetNumberOfAllVisits(userid).ToString(); } }