473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Repeater Control Problem...

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
Nov 18 '05 #1
1 1611
Do an e.Item.FindControl in the ItemDataBound event. You can then access it
when you .DataBind().

Sam

"Kristoffer Arfvidson" <kr********@spamtrap.com> wrote in message
news:Oz*************@TK2MSFTNGP11.phx.gbl...
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

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
5
by: Brad Baker | last post by:
I am trying to make a "tabbed" interface by iterating through a dataset with a conditional statement. For example: ...
1
by: jazzart | last post by:
Hi there, I'm fairly new to programming with Asp.Net 2.0 so I'm finding myself regularly fumbling around in the dark a bit, so to speak. I'm currently using Visual Web Developer and have been...
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.