datagrid level-breaks question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know this is a simple question, but I just can't seem to figure this out.
i have a table with the following date:
colors, red
colors,blue
colors, green
Animals cat
animals bird
people, Tom
people, Bill
people, Kris
i want to have a level break so that the data output as follows

Colors
Red
Blue
green
Animals
cat
bird
People
Tom
Bill
Kris
I have not found how to do this.
any ideas or walk through's?
thanks
kes
 
Kurt Schroeder said:
I know this is a simple question, but I just can't seem to figure this out.
i have a table with the following date:
colors, red
colors,blue
colors, green
Animals cat
animals bird
people, Tom
people, Bill
people, Kris
i want to have a level break so that the data output as follows

Colors
Red
Blue
green
Animals
cat
bird
People
Tom
Bill
Kris
I have not found how to do this.
any ideas or walk through's?
thanks
kes

There are two method that I am aware of. One is to look at the
onitemdatabound method and test for a new "category". I think if you google
on that you will find many examples. The other is to do something like the
following.
In your code for the control put something like this. I think this method is
probably more overhead but it does work.

private dim strLastName as string = string.empty

Public function DesnameBinder(strDesName as string) as string
if strDesName <> strLastName then
strLastName = strDesName
return "<br><a class='subheading'>" & strDesName & "</a><br>"
else
return nothing
end if
End function

In the item template put the following. In my case "DesignerName" is one of
column names of my data.

<%# DesnameBinder(DataBinder.Eval(Container.DataItem, "DesignerName")) %>
 
Back
Top