title: Displaying current page stats for RadGrid
body: <p>So, I'm trying to display something like "Displaying 1-20 of 100" using a RadGrid control. I put the following code in the RadGrid1_PageIndexChanged event:</p>
  
  <pre><code>int showingRowsFrom = ((e.NewPageIndex + 1) * rgResults.PageSize) - rgResults.PageSize + 1;
  int showingRowsTo;
  
  if ((e.NewPageIndex + 1) == rgResults.PageCount)
  {
      showingRowsTo = GridSource.Tables[0].Rows.Count;
  }
  else
  {
      showingRowsTo = (e.NewPageIndex + 1) * rgResults.PageSize;
  }
  
  string rowCount = string.Format("Displaying {0}-{1} of {2}", showingRowsFrom, showingRowsTo, GridSource.Tables[0].Rows.Count);
  lblResultsCountBottom.Text = lblResultsCountTop.Text = rowCount;
  </code></pre>
  
  <p>Unfortunately, it looks like this doesn't do a full postback and the label doesn't end up getting updated. How can I go about doing this? I tried doing it client side and had problems with this, too. It says $find is undefined.</p>
  
  <pre><code>$(document).ready(function () {
      var grid = $find("&lt;%=rgResults.ClientID%&gt;");
      var mtv = grid.get_masterTableView();
      var pageIndex = mtv.get_currentPageIndex();
      alert(pageIndex);
  });
  </code></pre>
  
  <p>Here's the radgrid code:</p>
  
  <pre><code>&lt;radG:RadGrid ID="rgResults" runat="server" AllowMultiRowSelection="True" AllowPaging="True"
          AllowSorting="True" EnableAJAX="False" GridLines="None" OnItemCommand="rgResults_ItemCommand" OnItemDataBound="rgResults_ItemDataBound"
          PageSize="20"
          Skin="Default" Width="100%" OnPageIndexChanged="rgResults_PageIndexChanged" OnSortCommand="rgResults_SortCommand" OnInit="rgResults_Init" OnPreRender="rgResults_PreRender"&gt;
      &lt;ClientSettings ApplyStylesOnClient="True"&gt;
      &lt;/ClientSettings&gt;
      &lt;ItemStyle CssClass="griditemtext" /&gt;
      &lt;HeaderStyle CssClass="gridheadertext" /&gt;
      &lt;FooterStyle CssClass="gridfootertext" /&gt;
      &lt;AlternatingItemStyle CssClass="gridalternetitemtext" /&gt;
      &lt;PagerStyle CssClass="gridpagertext" Mode="NumericPages" /&gt;
      &lt;CommandItemStyle CssClass="gridcommandtext" /&gt;
      &lt;SelectedItemStyle CssClass="gridselecteditemtext" /&gt;
      &lt;MasterTableView AutoGenerateColumns="False"
          DataKeyNames="Article Number" Font-Bold="False" Font-Italic="False" CommandItemDisplay="None" Font-Overline="False"
          Font-Strikeout="False" Font-Underline="False" GridLines="Both"&gt;
          &lt;ExpandCollapseColumn Visible="False"&gt;
              &lt;HeaderStyle Width="19px" /&gt;
          &lt;/ExpandCollapseColumn&gt;
          &lt;RowIndicatorColumn Visible="False"&gt;
              &lt;HeaderStyle Width="20px" /&gt;
          &lt;/RowIndicatorColumn&gt;
          &lt;PagerStyle Mode="NumericPages" /&gt;
          &lt;Columns&gt;
          &lt;/Columns&gt;
      &lt;/MasterTableView&gt;
  &lt;/radG:RadGrid&gt;
  </code></pre>
  
  <p>I won't post the code for all of the columns, because they're all done the same way, but here's the gist :-p</p>
  
  <pre><code>var hyperLinkColumn = new GridHyperLinkColumn
  {
      DataNavigateUrlFields = new[] { "TransactionID" },
      Target = "_blank",
      DataNavigateUrlFormatString = @"~/w1/SearchResultDetail.aspx?id={0}",
      DataTextField = "Article Number",
      HeaderText = "Article Number",
      SortExpression = "Article Number",
      UniqueName = "ArticleNumber"
  };
  rgResults.Columns.Add(hyperLinkColumn);
  </code></pre>