Groups | Blog | Home
all groups > asp.net datagrid control > may 2004 >

asp.net datagrid control : Problem creating custom header when datagrid AllowPaging=true



Atanas Marinov
5/28/2004 2:56:28 PM
I have very strange problem with custom header.
I create this in PreRender event, and if datagrid AllowPaging property =
is false, result looks like this:

CustomerID Sells Amount=20
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 =
1459 2318.9=20


BUT, if AllowPaging=3Dtrue, the result is:

Sells Amount=20

CustomerID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 =
1459 2318.9=20
BLAUS 625 677 1143.8 330 464 =20
BLONP 730 4049 3212.8 1176 450 2080 7390.2 =20
BOLID 280 982 4035.8=20
BONAP 843 3000.4 4106.3 3000 1903 2032 3948.9 5017.35 =20
BOTTM 4533.5 9222.6 3900.8 3118 1832.8=20
1 2 3 4 5 6 7 8 9=20



I don`t know why does it do this, and I don`t see any way around besides =
disabling paging?
Looks like a bug to me, have anybody noticed this problem before, does =
anybody know how to solve it?
Thanks in advance

Alvin Bruney [MVP]
5/28/2004 5:42:22 PM
post your pre-render code

--=20
Regards,
Alvin Bruney=20
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
[quoted text, click to view]
I have very strange problem with custom header.
I create this in PreRender event, and if datagrid AllowPaging property =
is false, result looks like this:

CustomerID Sells Amount=20
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 =
630 1459 2318.9=20


BUT, if AllowPaging=3Dtrue, the result is:

Sells Amount=20

CustomerID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 =
630 1459 2318.9=20
BLAUS 625 677 1143.8 330 464 =20
BLONP 730 4049 3212.8 1176 450 2080 7390.2 =20
BOLID 280 982 4035.8=20
BONAP 843 3000.4 4106.3 3000 1903 2032 3948.9 5017.35 =20
BOTTM 4533.5 9222.6 3900.8 3118 1832.8=20
1 2 3 4 5 6 7 8 9=20



I don`t know why does it do this, and I don`t see any way around =
besides disabling paging?
Looks like a bug to me, have anybody noticed this problem before, does =
anybody know how to solve it?
Thanks in advance

Atanas Marinov
5/29/2004 2:05:20 AM
It works just fine when AllowPaging=3Dfalse, but ok, here it is

private void dgrReportResult_PreRender(object sender, System.EventArgs =
e)

{

if((bool)Session["CrosstabWasMade"])

DoCrosstabHeaders(ref dgrReportResult, =
(string)Session["CrosstabValueColum"]);


}


provate void DoCrosstabHeaders(ref DataGrid dgr, string =
CrosstabAreaName)

{

Table =
tblResult=3D((System.Web.UI.WebControls.Table)dgr.Controls[0]);

DataGridItem dgitem=3Dnew DataGridItem(0,0,ListItemType.Header);

TableCell tc=3Dnew TableCell();

tc.BackColor=3DtblResult.Rows[0].Cells[0].BackColor;

tc.Text=3DtblResult.Rows[0].Cells[0].Text;

tc.RowSpan=3D2;

dgitem.Cells.Add(tc);

tc=3Dnew TableCell();

tc.BackColor=3DtblResult.Rows[0].Cells[0].BackColor;

tc.Text=3DCrosstabAreaName;

tc.HorizontalAlign=3DHorizontalAlign.Center;

tc.ColumnSpan=3DtblResult.Rows[0].Cells.Count;

dgitem.Cells.Add(tc);

tblResult.Rows[0].Cells.RemoveAt(0);

dgr.Controls[0].Controls.AddAt(0,dgitem);

}



----- Original Message -----=20
From: Alvin Bruney [MVP]=20
Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
Sent: Saturday, May 29, 2004 1:42 AM
Subject: Re: Problem creating custom header when datagrid =
AllowPaging=3Dtrue


post your pre-render code

--=20
Regards,
Alvin Bruney=20
[ASP.NET MVP http://mvp.supportmicrosoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
[quoted text, click to view]
I have very strange problem with custom header.
I create this in PreRender event, and if datagrid AllowPaging =
property is false, result looks like this:

CustomerID Sells Amount=20
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 =
630 1459 2318.9=20


BUT, if AllowPaging=3Dtrue, the result is:

Sells Amount=20

CustomerID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec=20
ALFKI 851 491.2 960 1086 1208 =20
ANATR 514.4 479.75 88.8 320 =20
ANTON 660 881.25 2156.5 2082 1332.4 403.2 =20
AROUT 735 5065 491.5 2142.9 1704 1101 2567.1=20
BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 =
630 1459 2318.9=20
BLAUS 625 677 1143.8 330 464 =20
BLONP 730 4049 3212.8 1176 450 2080 7390.2 =20
BOLID 280 982 4035.8=20
BONAP 843 3000.4 4106.3 3000 1903 2032 3948.9 5017.35 =20
BOTTM 4533.5 9222.6 3900.8 3118 1832.8=20
1 2 3 4 5 6 7 8 9=20



I don`t know why does it do this, and I don`t see any way around =
besides disabling paging?
Looks like a bug to me, have anybody noticed this problem before, =
does anybody know how to solve it?
Thanks in advance

AddThis Social Bookmark Button