By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,704 Members | 1,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,704 IT Pros & Developers. It's quick & easy.

Repeater Question

P: n/a
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

Sep 18 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Put both rows in the ItemTemplate:

<itemtemplate>
<tr runat="server" id="headerRow">
<td colspan=4>'TheCategory"</td>
</td>
<tr>
<td>Category</td>
<td>Data1</td>
<td>Data2</td>
<td>Data3</td>
</tr>

<itemtemplate>

and hide is in either ItemDataBound or PreRender event as

item.FindControl("headerRow").Visible = false;

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Just Me" <news.microsoft.comwrote in message
news:u6****************@TK2MSFTNGP02.phx.gbl...
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



Sep 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.