Repeater Control Problem...

  • Thread starter Kristoffer Arfvidson
  • Start date
K

Kristoffer Arfvidson

Hi!
How can I access a label that I put inside a headertemplate inside a
repeatercontrol from my codebehind?

Or, can I dynamicly add the content of headertemplate from codebehind?

Because I use the same repeater for different views, and I need to modify
the headertemplate dynamicly, depending of the current selection before...

Heres some example code:
-------
<asp:repeater id=Repeater1 runat="server">
<ItemTemplate>
<tr>
<td>
<div align="center">BLABLABLA
<br>
</div>
</td>
</tr>
</ItemTemplate>
<HeaderTemplate>
<tr>
<td>
<b><asp:label id="lblHeadline" Runat="server">SOME TEXT
HERE:</asp:label><br></b>
</td>
</tr>
</HeaderTemplate>
<FooterTemplate>
<tr>
<td>Blablabla
</td>
</tr>
</FooterTemplate>
</asp:repeater>

--------------------
So, now, from the page_load()
HOW?? Do I access the lblHeadline ??
or, How Do I add the context of headerTemplate from Page_Load()

OR, Do I need to use another control?

Yours: Kristoffer
 
S

Sam Fields

Do an e.Item.FindControl in the ItemDataBound event. You can then access it
when you .DataBind().

Sam
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top