gridview formatting

Discussion in 'ASP .Net Datagrid Control' started by John, Jun 7, 2006.

  1. John

    John Guest

    On my gridview I need to group the sales by year.
    2000 - 2001 - 2002, etc is there a way to do this with using the gridview?

    example:
    sales for: 2000
    data
    blank row
    sales for: 2001
    data
    blank row

    now the data that is being pulled back to populate the grid is the year
    John, Jun 7, 2006
    #1
    1. Advertising

  2. of course you can...

    <asp:GridView id="gv2003" ...
    <br />
    <asp:GridView id="gv2002" ...
    <br />
    <asp:GridView id="gv2001" ...
    <br />
    <asp:GridView id="gv2000" ...


    and populate each grid view with the data you want, you could even have a
    function that returns a datatable and in page_load statmente you should
    write something like:

    gv2003.DataSource = loadData("2003")
    gv2003.DataBind()
    gv2002.DataSource = loadData("2002")
    gv2002.DataBind()
    gv2001.DataSource = loadData("2001")
    gv2001.DataBind()
    gv2000.DataSource = loadData("2000")
    gv2000.DataBind()


    because to add a blank row to your GV you need to use OnRowCreate statement
    from the GV, and then you need to separate the data from years, it could
    give you more work than the simple I showed you above...

    ....if you have a problem about time consuming, because you are getting
    values from the DB 4 times, you could do that once and populate a datatable
    and then using DataTable filtering you can sort the data through the 4
    individual GV's
    --

    Bruno Alexandre
    (a Portuguese in Københanv, Danmark)


    "John" <> escreveu na mensagem
    news:%...
    > On my gridview I need to group the sales by year.
    > 2000 - 2001 - 2002, etc is there a way to do this with using the gridview?
    >
    > example:
    > sales for: 2000
    > data
    > blank row
    > sales for: 2001
    > data
    > blank row
    >
    > now the data that is being pulled back to populate the grid is the year
    >
    >
    >
    Bruno Alexandre, Jun 7, 2006
    #2
    1. Advertising

  3. John

    John Guest

    ah, no. I'm not having anywhere from 1 to 20 grids on my page.
    could this be done easier using a datagrid instead of the gridview?

    "Bruno Alexandre" <> wrote in message
    news:...
    > of course you can...
    >
    > <asp:GridView id="gv2003" ...
    > <br />
    > <asp:GridView id="gv2002" ...
    > <br />
    > <asp:GridView id="gv2001" ...
    > <br />
    > <asp:GridView id="gv2000" ...
    >
    >
    > and populate each grid view with the data you want, you could even have a
    > function that returns a datatable and in page_load statmente you should
    > write something like:
    >
    > gv2003.DataSource = loadData("2003")
    > gv2003.DataBind()
    > gv2002.DataSource = loadData("2002")
    > gv2002.DataBind()
    > gv2001.DataSource = loadData("2001")
    > gv2001.DataBind()
    > gv2000.DataSource = loadData("2000")
    > gv2000.DataBind()
    >
    >
    > because to add a blank row to your GV you need to use OnRowCreate
    > statement from the GV, and then you need to separate the data from years,
    > it could give you more work than the simple I showed you above...
    >
    > ...if you have a problem about time consuming, because you are getting
    > values from the DB 4 times, you could do that once and populate a
    > datatable and then using DataTable filtering you can sort the data through
    > the 4 individual GV's
    > --
    >
    > Bruno Alexandre
    > (a Portuguese in Københanv, Danmark)
    >
    >
    > "John" <> escreveu na mensagem
    > news:%...
    >> On my gridview I need to group the sales by year.
    >> 2000 - 2001 - 2002, etc is there a way to do this with using the
    >> gridview?
    >>
    >> example:
    >> sales for: 2000
    >> data
    >> blank row
    >> sales for: 2001
    >> data
    >> blank row
    >>
    >> now the data that is being pulled back to populate the grid is the year
    >>
    >>
    >>

    >
    >
    John, Jun 7, 2006
    #3
  4. GridView is way better than DataGrid... just remember that GridView is the
    2nd version of the DataGrid in .NET 1.x

    you could still do the same as I mencionated, use the GV_RowCreate and
    separate your data.
    --

    Bruno Alexandre
    (a Portuguese in Københanv, Danmark)


    "John" <> escreveu na mensagem
    news:Oql%...
    > ah, no. I'm not having anywhere from 1 to 20 grids on my page.
    > could this be done easier using a datagrid instead of the gridview?
    >
    > "Bruno Alexandre" <> wrote in message
    > news:...
    >> of course you can...
    >>
    >> <asp:GridView id="gv2003" ...
    >> <br />
    >> <asp:GridView id="gv2002" ...
    >> <br />
    >> <asp:GridView id="gv2001" ...
    >> <br />
    >> <asp:GridView id="gv2000" ...
    >>
    >>
    >> and populate each grid view with the data you want, you could even have a
    >> function that returns a datatable and in page_load statmente you should
    >> write something like:
    >>
    >> gv2003.DataSource = loadData("2003")
    >> gv2003.DataBind()
    >> gv2002.DataSource = loadData("2002")
    >> gv2002.DataBind()
    >> gv2001.DataSource = loadData("2001")
    >> gv2001.DataBind()
    >> gv2000.DataSource = loadData("2000")
    >> gv2000.DataBind()
    >>
    >>
    >> because to add a blank row to your GV you need to use OnRowCreate
    >> statement from the GV, and then you need to separate the data from years,
    >> it could give you more work than the simple I showed you above...
    >>
    >> ...if you have a problem about time consuming, because you are getting
    >> values from the DB 4 times, you could do that once and populate a
    >> datatable and then using DataTable filtering you can sort the data
    >> through the 4 individual GV's
    >> --
    >>
    >> Bruno Alexandre
    >> (a Portuguese in Københanv, Danmark)
    >>
    >>
    >> "John" <> escreveu na mensagem
    >> news:%...
    >>> On my gridview I need to group the sales by year.
    >>> 2000 - 2001 - 2002, etc is there a way to do this with using the
    >>> gridview?
    >>>
    >>> example:
    >>> sales for: 2000
    >>> data
    >>> blank row
    >>> sales for: 2001
    >>> data
    >>> blank row
    >>>
    >>> now the data that is being pulled back to populate the grid is the year
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
    Bruno Alexandre, Jun 7, 2006
    #4
  5. John

    John Guest

    how would I seperate the data though? I'm getting the year back in the
    dataset thats populating the grid. So how can i read that row/column that
    has the year and break it apart and show the data pertaining to that year?


    "Bruno Alexandre" <> wrote in message
    news:...
    > GridView is way better than DataGrid... just remember that GridView is the
    > 2nd version of the DataGrid in .NET 1.x
    >
    > you could still do the same as I mencionated, use the GV_RowCreate and
    > separate your data.
    > --
    >
    > Bruno Alexandre
    > (a Portuguese in Københanv, Danmark)
    >
    >
    > "John" <> escreveu na mensagem
    > news:Oql%...
    >> ah, no. I'm not having anywhere from 1 to 20 grids on my page.
    >> could this be done easier using a datagrid instead of the gridview?
    >>
    >> "Bruno Alexandre" <> wrote in message
    >> news:...
    >>> of course you can...
    >>>
    >>> <asp:GridView id="gv2003" ...
    >>> <br />
    >>> <asp:GridView id="gv2002" ...
    >>> <br />
    >>> <asp:GridView id="gv2001" ...
    >>> <br />
    >>> <asp:GridView id="gv2000" ...
    >>>
    >>>
    >>> and populate each grid view with the data you want, you could even have
    >>> a function that returns a datatable and in page_load statmente you
    >>> should write something like:
    >>>
    >>> gv2003.DataSource = loadData("2003")
    >>> gv2003.DataBind()
    >>> gv2002.DataSource = loadData("2002")
    >>> gv2002.DataBind()
    >>> gv2001.DataSource = loadData("2001")
    >>> gv2001.DataBind()
    >>> gv2000.DataSource = loadData("2000")
    >>> gv2000.DataBind()
    >>>
    >>>
    >>> because to add a blank row to your GV you need to use OnRowCreate
    >>> statement from the GV, and then you need to separate the data from
    >>> years, it could give you more work than the simple I showed you above...
    >>>
    >>> ...if you have a problem about time consuming, because you are getting
    >>> values from the DB 4 times, you could do that once and populate a
    >>> datatable and then using DataTable filtering you can sort the data
    >>> through the 4 individual GV's
    >>> --
    >>>
    >>> Bruno Alexandre
    >>> (a Portuguese in Københanv, Danmark)
    >>>
    >>>
    >>> "John" <> escreveu na mensagem
    >>> news:%...
    >>>> On my gridview I need to group the sales by year.
    >>>> 2000 - 2001 - 2002, etc is there a way to do this with using the
    >>>> gridview?
    >>>>
    >>>> example:
    >>>> sales for: 2000
    >>>> data
    >>>> blank row
    >>>> sales for: 2001
    >>>> data
    >>>> blank row
    >>>>
    >>>> now the data that is being pulled back to populate the grid is the year
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    John, Jun 7, 2006
    #5
  6. John

    Riki Guest

    Google is your friend:
    http://www.google.com/search?q=gridview grouping

    If you're prepared to do some modifications from DataGrid to GridView,
    there's a lot more to find about DataGrid grouping.

    --

    Riki

    "John" <> wrote in message
    news:%...
    > On my gridview I need to group the sales by year.
    > 2000 - 2001 - 2002, etc is there a way to do this with using the gridview?
    >
    > example:
    > sales for: 2000
    > data
    > blank row
    > sales for: 2001
    > data
    > blank row
    >
    > now the data that is being pulled back to populate the grid is the year
    >
    >
    >
    Riki, Jun 8, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10

    GridView Formatting

    sck10, Oct 7, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    16,376
    Steven Cheng[MSFT]
    Oct 18, 2004
  2. Not Me
    Replies:
    0
    Views:
    481
    Not Me
    Sep 23, 2005
  3. washoetech

    Gridview Item formatting

    washoetech, Sep 29, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    9,074
    Steven Cheng[MSFT]
    Sep 30, 2005
  4. Replies:
    2
    Views:
    4,575
  5. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,961
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
Loading...

Share This Page