Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Question about pager.pattern property.
posted

How would I write the total number of rows into the text for pattern, cause i looked at the default tokens and 'total number of rows returned' doesnt seem to be supported. 

 I thought this would work but doesnt look like it:

Designer Page: 

pattern="test this: <%= strRow %>"

Code Behind:

public string strRow = "4";

 

J

 

Parents
No Data
Reply
  • 10
    posted

    you can try this one :)

    /// <summary>
            ///
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void gridLab_InitializeLayout(
                object sender
                , LayoutEventArgs e)
            {
                gridLab.DisplayLayout.Pager.AllowPaging = true;
                gridLab.DisplayLayout.Pager.PageSize = 5;
                gridLab.DisplayLayout.Pager.PagerAppearance = PagerAppearance.Top;
                gridLab.DisplayLayout.Pager.Alignment = PagerAlignment.Left;
                gridLab.DisplayLayout.Pager.StyleMode = PagerStyleMode.ComboBox;

                int fromItem = gridLab.DisplayLayout.Pager.CurrentPageIndex
                               *gridLab.DisplayLayout.Pager.PageSize
                               - (gridLab.DisplayLayout.Pager.PageSize - 1);

                int toItem = gridLab.DisplayLayout.Pager.CurrentPageIndex
                             *gridLab.DisplayLayout.Pager.PageSize;

               toItem = toItem > totalItems ? totalItems : toItem;

                 gridLab.DisplayLayout.Pager.Pattern =
                    String.Format("Showing {0} - {1} of {2} | [page:first:First] [page:prev:Previous] Page [default] [page:next:Next] [page:last:Last]"
                    , fromItem
                    , toItem
                    , ViewState["Rows"]);
            }

            /// <summary>
            ///
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void gridLab_InitializeDataSource(
                object sender
                , UltraGridEventArgs e)
            {
                DataTable networkDataTable =
                    SingletonProvider<DataSourceProvider>.Instance.CreateData(
                        Server.MapPath("~/App_Data/NetworkData.xml")
                        , "NetworkDataSet"
                        , "NetworkTable");

                ViewState["Rows"] = networkDataTable.Rows.Count;

                gridLab.DataSource = networkDataTable;
                gridLab.DataBind();
            }

Children
No Data