To add a footer to your Gridview you can use this code. I’ve seen other samples that “deleted” the columns, but I couldn’t get those to work (they hung off the side still visible)!
protected void gvLOContactsNotAssigned_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
AddValidations(sender, e);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "* Contact Phone is required";
//how many cells?
int cols = e.Row.Cells.Count;
for (int i = 0; i < cols; i++)
{
//remove all but the first (0)
if (i != 0)
{
e.Row.Cells[i].Visible = false;
}
}
//span the length of the other cells
e.Row.Cells[0].ColumnSpan = cols;
}
}
Monday, February 28, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment