//
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Footer)
{
// e.Item.BackColor = Color.SeaGreen;
// e.Item.Font.Bold = true;
e.Item.Cells.RemoveAt(0);
e.Item.Cells.RemoveAt(0);
e.Item.Cells[0].ColumnSpan = 3;
e.Item.Cells[0].HorizontalAlign = HorizontalAlign.Right;
}
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Footer)
{
// e.Item.BackColor = Color.SeaGreen;
// e.Item.Font.Bold = true;
e.Item.Cells.RemoveAt(0);
e.Item.Cells.RemoveAt(0);
e.Item.Cells[0].ColumnSpan = 3;
e.Item.Cells[0].HorizontalAlign = HorizontalAlign.Right;
}
博客给出了一段代码,是关于DataGrid控件的ItemCreated事件处理。在事件处理方法中,判断项类型为页脚时,对页脚单元格进行操作,如移除单元格、设置列跨度和水平对齐方式等。
1万+

被折叠的 条评论
为什么被折叠?



