如何在RadGrid Telerik中显示页脚的总列数

shi*_*ish 1 asp.net radgrid telerik-grid

如何在Telerik的RadGrid页脚中显示总列数?

Eri*_*ker 5

您需要绑定到ItemDataBound事件:

int counter = 0;

void Grid_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e) {
      if(e.Item is GridDataItem) {
         GridDataItem dataItem = e.Item as GridDataItem;
         counter += Convert.ToInt32(dataItem["SomeField"].Text);
      }
      else if(e.Item is GridFooterItem) {
         GridFooterItem footerItem = e.Item as GridFooterItem;
         FooterItem["YourFooterColumn"].Text = counter.ToString();
      }
 }
Run Code Online (Sandbox Code Playgroud)