DataGrid - Multiple values in single Row

M

malavika reddy

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:
 
E

Eliyahu Goldin

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
 
R

Rajesh Tiwari

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top