void BindData() { ReceivedMessageQuery query = new ReceivedMessageQuery(); query.PageIndex = this.pager.PageIndex; query.PageSize = this.pager.PageSize; query.UserName = HiContext.Current.User.Username; DbQueryResult receivedMessages = CommentsHelper.GetReceivedMessages(query); if (((DataTable)receivedMessages.Data).Rows.Count <= 0) { query.PageIndex = this.messagesList.PageIndex - 1; receivedMessages = CommentsHelper.GetReceivedMessages(query); this.messagesList.DataSource = receivedMessages.Data; } this.messagesList.DataSource = receivedMessages.Data; this.messagesList.DataBind(); this.pager.TotalRecords = receivedMessages.TotalRecords; }