protected void Page_Load(object sender, EventArgs e) { lbMngr = new LeaderboardManager(); expMngr = new ExperienceManager(); List<LeaderBoardItem> userItemSet = lbMngr.getLeaderBoardValues(1, false); if (!Page.IsPostBack) { GridView1.Columns[2].Visible = true; GridView1.Columns[3].Visible = true; GridView1.Columns[4].Visible = false; GridView1.Columns[5].Visible = false; GridView1.DataSource = userItemSet; GridView1.DataBind(); } HtmlGenericControl li = (HtmlGenericControl)this.Page.Master.FindControl("Ulnav").FindControl("liLeaderboards"); li.Attributes.Add("class", "active"); userName = User.Identity.Name; if (Request.IsAuthenticated) { userRankMultiView.ActiveViewIndex = 1; //user's rank gridview databinding LeaderBoardItem userItem = lbMngr.getUserValues(userName); List<LeaderBoardItem> userItemList = new List<LeaderBoardItem>(); userItemList.Add(userItem); GridView2.DataSource = userItemList; GridView2.DataBind(); GridView2.Columns[2].Visible = true; GridView2.Columns[3].Visible = true; GridView2.Columns[4].Visible = false; GridView2.Columns[5].Visible = false; for (int i = 0; i < GridView1.Rows.Count; i++) { if (GridView1.Rows[i].Cells[1].Text.ToLower() == userName.ToLower()) { GridView1.Rows[i].BorderWidth = 1; GridView1.Rows[i].BorderColor = System.Drawing.Color.Green; } } foreach (LeaderBoardItem lbi in userItemSet) { if (lbi.userName.ToLower() == userName.ToLower()) GridView2.Rows[0].Cells[0].Text = lbi.rank.ToString(); } } else { userRankMultiView.ActiveViewIndex = 0; } }