Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can be implemented using the ASPxGridView using the following approach:</p> <p>1) calculate summary in a separate method. 2) use the detail GridView's DataBound and BeforeGetCallBackResult event handlers to set the label's text. Here is my code:</p> <pre><code>protected int CalcPageSummary(ASPxGridView gridView, string fieldName) { GridViewDataColumn column = gridView.Columns[fieldName] as GridViewDataColumn; if(column == null) return 0; int pageIndex = gridView.PageIndex; int startRowIndex = pageIndex * gridView.SettingsPager.PageSize; int finishRowIndex = startRowIndex + gridView.SettingsPager.PageSize; if(finishRowIndex &gt; gridView.VisibleRowCount) finishRowIndex = gridView.VisibleRowCount; int result = 0; for(int i = startRowIndex; i &lt; finishRowIndex; i++) result += Convert.ToInt32(gridView.GetRowValues(i, fieldName)); return result; } private void SetColumnSummary(ASPxGridView gridView, string fieldName) { ASPxLabel lbl = gridView.FindFooterCellTemplateControl(gridView.Columns[fieldName], "ASPxLabel1") as ASPxLabel; if(lbl != null) lbl.Text = CalcPageSummary(gridView, fieldName).ToString(); } protected void ASPxGridView2_BeforeGetCallbackResult(object sender, EventArgs e) { SetColumnSummary((ASPxGridView)sender, "UnitPrice"); } protected void ASPxGridView2_BeforePerformDataSelect(object sender, EventArgs e) { Session["CategoryID"] = (sender as ASPxGridView).GetMasterRowKeyValue(); } protected void ASPxGridView2_DataBound(object sender, EventArgs e) { SetColumnSummary((ASPxGridView)sender, "UnitPrice"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload