DataGrid - Multiple values in single Row

Discussion in 'ASP .Net Datagrid Control' started by malavika reddy, Nov 3, 2004.

  1. Hi,

    Been stuck on this one for a bit. Would really appreciate any help on
    this one.

    In Regards to ASP.NET

    To start. I have a dataset al like this (ex)

    ------------------------------------
    category | category type
    ------------------------------------
    categ1 type-1
    categ1 type-2
    categ1 type-3
    categ2 type-4
    categ3 type-6
    categ3 type-7
    categ3 type-8


    I need to display this in a way (DataGrid)


    It will need to look something like this:

    ------------------------------------------
    category | category type
    ------------------------------------------
    categ1 type-1
    type-2
    type-3
    -----------------------------------------
    categ2 type-4
    ---------------------------------------
    categ3 type-6
    type-7
    type-8
    ---------------------------------------



    Has anybody got something like this working.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    malavika reddy, Nov 3, 2004
    #1
    1. Advertising

  2. The directions:

    In PreRender event loop through the data rows. When you detect a new value
    for category, save it. For the next row check if the category value matches
    the saved one. If it does, replace it with an empty string. If it doesn't,
    add a border-top css rule.

    Eliyahu

    "malavika reddy" <> wrote in message
    news:...
    >
    > Hi,
    >
    > Been stuck on this one for a bit. Would really appreciate any help on
    > this one.
    >
    > In Regards to ASP.NET
    >
    > To start. I have a dataset al like this (ex)
    >
    > ------------------------------------
    > category | category type
    > ------------------------------------
    > categ1 type-1
    > categ1 type-2
    > categ1 type-3
    > categ2 type-4
    > categ3 type-6
    > categ3 type-7
    > categ3 type-8
    >
    >
    > I need to display this in a way (DataGrid)
    >
    >
    > It will need to look something like this:
    >
    > ------------------------------------------
    > category | category type
    > ------------------------------------------
    > categ1 type-1
    > type-2
    > type-3
    > -----------------------------------------
    > categ2 type-4
    > ---------------------------------------
    > categ3 type-6
    > type-7
    > type-8
    > ---------------------------------------
    >
    >
    >
    > Has anybody got something like this working.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Eliyahu Goldin, Nov 3, 2004
    #2
    1. Advertising

  3. you can set a global variable say "categ"

    then

    loop through the items in itemdatabound event of datagrid and
    set the value of categ to the new value. and compare the value of categ and
    the value you get fom database and based upon that set the contents of the
    cell to empty.
    e.g
    dim categ as string=""
    public sub onitemdatabound( sender as object ,e as datagriditemeventargs)
    if e.itemtype=itemtype.item or e.item.itemtype=itemtype.alternatingitem then
    catfromDB=e.item.dataitem("category")
    if catFromDB =categ and categ<>"" then
    e.item.cells(0).text=""
    else
    e.item.cells(0).text=catFromDB
    end if
    categ=catFromDB
    end sub

    the code may not work exactly as it is written but it is just to give you
    some idea how to proceed.

    "malavika reddy" <> wrote in message
    news:...
    >
    > Hi,
    >
    > Been stuck on this one for a bit. Would really appreciate any help on
    > this one.
    >
    > In Regards to ASP.NET
    >
    > To start. I have a dataset al like this (ex)
    >
    > ------------------------------------
    > category | category type
    > ------------------------------------
    > categ1 type-1
    > categ1 type-2
    > categ1 type-3
    > categ2 type-4
    > categ3 type-6
    > categ3 type-7
    > categ3 type-8
    >
    >
    > I need to display this in a way (DataGrid)
    >
    >
    > It will need to look something like this:
    >
    > ------------------------------------------
    > category | category type
    > ------------------------------------------
    > categ1 type-1
    > type-2
    > type-3
    > -----------------------------------------
    > categ2 type-4
    > ---------------------------------------
    > categ3 type-6
    > type-7
    > type-8
    > ---------------------------------------
    >
    >
    >
    > Has anybody got something like this working.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Rajesh Tiwari, Dec 2, 2004
    #3
    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. =?Utf-8?B?U3VyZXNo?=
    Replies:
    1
    Views:
    451
    Saravana
    Nov 22, 2004
  2. Randall Parker
    Replies:
    1
    Views:
    589
    S. Justin Gengo
    Dec 12, 2005
  3. D
    Replies:
    0
    Views:
    197
  4. AlainCD
    Replies:
    0
    Views:
    198
    AlainCD
    Jan 12, 2006
  5. ela
    Replies:
    12
    Views:
    333
    Uri Guttman
    Apr 6, 2009
Loading...

Share This Page