Professional Web Applications Themes

Problem creating custom header when datagrid AllowPaging=true - ASP.NET Data Grid Control

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 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ALFKI 851 491.2 960 1086 1208 ANATR 514.4 479.75 88.8 320 ANTON 660 881.25 2156.5 2082 1332.4 403.2 AROUT 735 5065 491.5 2142.9 1704 1101 2567.1 BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 1459 2318.9 BUT, if AllowPaging=true, the result is: Sells Amount CustomerID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ALFKI 851 ...

  1. #1

    Default Problem creating custom header when datagrid AllowPaging=true

    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
    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    ALFKI 851 491.2 960 1086 1208
    ANATR 514.4 479.75 88.8 320
    ANTON 660 881.25 2156.5 2082 1332.4 403.2
    AROUT 735 5065 491.5 2142.9 1704 1101 2567.1
    BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 1459 2318.9


    BUT, if AllowPaging=true, the result is:

    Sells Amount

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



    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

    Atanas Marinov Guest

  2. #2

    Default Re: Problem creating custom header when datagrid AllowPaging=true

    post your pre-render code

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP [url]http://mvp.support.microsoft.com/default.aspx][/url]
    Got tidbits? Get it here... [url]http://tinyurl.com/27cok[/url]
    "Atanas Marinov" <nasoseedot.com> wrote in message news:ODnbesKREHA.4020TK2MSFTNGP11.phx.gbl...
    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
    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    ALFKI 851 491.2 960 1086 1208
    ANATR 514.4 479.75 88.8 320
    ANTON 660 881.25 2156.5 2082 1332.4 403.2
    AROUT 735 5065 491.5 2142.9 1704 1101 2567.1
    BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 1459 2318.9


    BUT, if AllowPaging=true, the result is:

    Sells Amount

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



    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

    Alvin Bruney [MVP] Guest

  3. #3

    Default Re: Problem creating custom header when datagrid AllowPaging=true

    It works just fine when AllowPaging=false, 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=((System.Web.UI.WebControls.Table)dgr.Co ntrols[0]);

    DataGridItem dgitem=new DataGridItem(0,0,ListItemType.Header);

    TableCell tc=new TableCell();

    tc.BackColor=tblResult.Rows[0].Cells[0].BackColor;

    tc.Text=tblResult.Rows[0].Cells[0].Text;

    tc.RowSpan=2;

    dgitem.Cells.Add(tc);

    tc=new TableCell();

    tc.BackColor=tblResult.Rows[0].Cells[0].BackColor;

    tc.Text=CrosstabAreaName;

    tc.HorizontalAlign=HorizontalAlign.Center;

    tc.ColumnSpan=tblResult.Rows[0].Cells.Count;

    dgitem.Cells.Add(tc);

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

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

    }



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


    post your pre-render code

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP [url]http://mvp.supportmicrosoft.com/default.aspx][/url]
    Got tidbits? Get it here... [url]http://tinyurl.com/27cok[/url]
    "Atanas Marinov" <nasoseedot.com> wrote in message news:ODnbesKREHA.4020TK2MSFTNGP11.phx.gbl...
    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
    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    ALFKI 851 491.2 960 1086 1208
    ANATR 514.4 479.75 88.8 320
    ANTON 660 881.25 2156.5 2082 1332.4 403.2
    AROUT 735 5065 491.5 2142.9 1704 1101 2567.1
    BERGS 3884.95 3397.7 2034.5 3192.65 1565.65 3605.6 4879.2 630 1459 2318.9


    BUT, if AllowPaging=true, the result is:

    Sells Amount

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



    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

    Atanas Marinov Guest

Similar Threads

  1. Creating Custom Datagrid that auto adds attributes at <TD> leve
    By TimG in forum ASP.NET Building Controls
    Replies: 1
    Last Post: May 8th, 08:20 PM
  2. Dynamically creating buttons in custom datagrid control
    By lawrence in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: November 18th, 05:19 PM
  3. Custom datagrid, really big problem :(
    By Ayca Aksu in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: October 27th, 02:53 PM
  4. How to find a record in a Datagrid with AllowPaging set to true.
    By Jim Mitchell in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 26th, 01:55 PM
  5. Problem to Access web control on the DataGrid Header
    By Prasad in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 11th, 10:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139