Hello Steve,
For your scenario, there are two possible means:
1. Directly access the repeater header through controls collection by
index(this is not quite recommended since index is not guranteed to work
between different version). e.g.
#header row is the first childcontrol in repeater's Controls collection
====================
protected void Button1_Click(object sender, EventArgs e)
{
Label lbl = Repeater1.Controls[0].FindControl("lblCurrentYr") as
Label;
if (lbl != null)
{
lbl.Text = "new text " + DateTime.Now.Ticks;
}
}
=========================
2. As Eliyahu has mentioned, one place we can access repeater's header(or
footer)'s controls is the ItemCreated, you can get the label in header in
that event and store it into a page variable so that you can use it later.
e.g.
========in page code behind=========
public partial class Part1_repeaterpage : System.Web.UI.Page
{
Label _repeaterLabel = null;
................
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<br/>label value: " + _repeaterLabel.Text);
}
protected void Repeater1_ItemCreated(object sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
Label lbl = e.Item.FindControl("lblCurrentYr") as Label;
if (lbl != null)
{
_repeaterLabel = lbl;
}
}
}
.....................
}
=============================
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.