DataGrid页脚数 [英] DataGrid Footer Count

查看:88
本文介绍了DataGrid页脚数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在使用DataGrid播放数据.我要计算行数,然后将其显示到页脚模板中.

我知道在GridView中我们使用RowDataBound事件.
但是我不知道这个DataGrid


谁能帮我做到这一点...


预先感谢....

Hi,


I''m using DataGrid for diaplaying Data. I want to count the no.of rows and then displayed that count into Footer Template.

I know in GridView for this we use RowDataBound Event.
But i don''t know about this DataGrid


can any one help me to do this ...


Thanx in advance....

推荐答案

在您的ItemDataBound Event或datagrid中尝试.
Try this in your ItemDataBound Event or datagrid.
protected void DataGrid1_ItemDataBound(Object sender, DataGridItemEventArgs e)
{
    if(e.Item.ItemType == ListItemType.Footer)
    {    
        // Count the items and set it
        e.Item.Cells[2].Text = DataGrid1.Items.Count.ToString();    
    }
}




希望对您有所帮助.
--Amit




Hope it helps.
--Amit


这篇关于DataGrid页脚数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆