Question On A Web Control

J

Just Me

If this is already posted, please excuse me, I sent it to the server but it
never appeared

Im using ASP.NET 2.0 and I have a repeater question.

I am trying to make a change to the ItemTemplate in the itemdatabound event.

Basically, this is a follow on from my previous question anyhow. I have rows
being display like so


Category Data Data Data
Green 1 2 3
Green 2 2 2
Blue 4 2 1
Blue 5 5 4


What I want out of my repeater "WHEN" the category changes

<tr>
<td colspan=4>'TheCategory"</td>
</td>
<tr>
<td>Category</td>
<td>Data1</td>
<td>Data2</td>
<td>Data3</td>
</tr>

And when "NOT CHANGED"
<tr>
<td>Category</td>
<td>Data1</td>
<td>Data2</td>
<td>Data3</td>
</tr>

So this would result in

Green
1 2 3
2 2 2

Blue
4 2 1
5 5 4


This means I have to manipulate the ItemTemplate, but im not sure how to go
about doing this in the Databound event. I need to hide / not display the
category row. Im sure there is an easy way to do this, but im struggling.


Cheers
 
B

bruce barker

just write a function that return the category name or "&nbsp;", and use
it in the binding expression.

hint: pass the Databinder instance to the function.

you can also catcg the databind event and do it there.

-- bruce (sqlwork.com)
 
J

Just Me

Ive sorted it now thanks.

It was quite easy in the end and I got exactly the result I wanted
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top