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
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(); }
hi, i got a workaround for you , this may help you .
Code behind
=========
public string RowCount = "";
{
UltraWebGrid1.DataSource = GetDataSource().Tables[0].DefaultView;
RowCount = dv.Count.ToString();
}
HTML
=======
</script>
<body onload="AssignTotalRow();">
\bump.
No one have any idea on how to include the total number or rows returned from a DataSet into the Pattern Porperty in the UltraWebGrid control?
Here is my designer code:
<Pager MinimumPagesForDisplay="2" Alignment="Center" AllowPaging="True" NextText="Next" PageSize="6" PrevText="Prev" StyleMode=QuickPages QuickPages=2 Pattern="<table width='100%'><tr><td width='20%' align='left'>Number of Rows Returned: <%= strTotalRows %></td><td align='center'>[page:first:First] [prev] [next] [page:last:Last]</td><td align='right' width='20%'>Page [currentpageindex] of [pagecount]</td></tr></table>" >
<Style BorderWidth="1px" BorderStyle="Solid" BackColor="#DCDADA" Font-Size="8pt">
</Style>
</Pager>
Here is my code behind:
public string strTotalRows = "4";
strTotalRows = "55";
Neither 4 nor 55 show up in my pattern property when the page gets rendered. Anyone have any ideas?