In case, when you are facing colspan problem in datagarid paging section, then use this code to correcting colspan problem.
protected void dGrid_PreRender(object sender, EventArgs e)
{
try
{
DataGrid dgSidDetails = (DataGrid)sender;
//Fix for numbering being in a left aligned column
//For some reason, the ColumnSpan property is ignored andnot rendered
//unless set using the Attributes
if (dgSidDetails.AllowPaging == true && dgSidDetails.AutoGenerateColumns == false)
{
//Get the Table
System.Web.UI.WebControls.Table tab =
(System.Web.UI.WebControls.Table)dgSidDetails.Controls[0];
//Change the Top Pager
if (dgSidDetails.PagerStyle.Position == PagerPosition.Bottom ||
dgSidDetails.PagerStyle.Position == PagerPosition.TopAndBottom)
{
tab.Rows[tab.Rows.Count -
1].Cells[0].Attributes.Add("colspan",
tab.Rows[1].Cells.Count.ToString());
}
//Change the Bottom Pager
if (dgSidDetails.PagerStyle.Position == PagerPosition.Top ||
dgSidDetails.PagerStyle.Position == PagerPosition.TopAndBottom)
{
tab.Rows[0].Cells[0].Attributes.Add("colspan",
tab.Rows[1].Cells.Count.ToString());
}
}
}
catch (Exception ex)
{
}
}