Home All Groups Group Topic Archive Search About

Issues with OnTextChanged using <asp:Repeater

Author
5 Jan 2006 10:59 PM
Fred Dag
As far as I can work out when using the OnTextChanged event I cannot get the
TextBox and Labels values when the event fires as they are populated by a
<asp:repeater and so don't have values.

If I try to give the repeater values  by removing
if (!IsPostBack)

{}

from the

Page_Load() method then my method is not called by the OnTextChanged event.

There is probably a limitation with my understanding of the event model.

How should I be getting OnTextChanged events from a <asp:repeater component
and getting details about the values from the other controls of the
<ItemTemplate> line that caused the event to trigger?



Thanks in advance

Author
6 Jan 2006 9:21 AM
Teemu Keiski
Hi,

if you have specific problems can you show the code?

Anyways, if you get TextChanged event to be raised, you can get to the
current repeater's item via sender (first argument in event handler method)
with code as follows:

RepeaterItem ritem =(RepeaterItem)((Control)sender).NamingContainer;

It would be the the parent item of the TextBox which raises this specific
TextChanged event. Then getting to other controls on the same item would be
just running FindControl againts the RepeaterItem

Label lbl=(Label)ritem.FindControl("Label1");

and so on

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Show quoteHide quote
"Fred Dag" <fred***@hostvilleit.com> wrote in message
news:u6PZkukEGHA.1028@TK2MSFTNGP11.phx.gbl...
> As far as I can work out when using the OnTextChanged event I cannot get
> the TextBox and Labels values when the event fires as they are populated
> by a <asp:repeater and so don't have values.
>
> If I try to give the repeater values  by removing
> if (!IsPostBack)
>
> {}
>
> from the
>
> Page_Load() method then my method is not called by the OnTextChanged
> event.
>
> There is probably a limitation with my understanding of the event model.
>
> How should I be getting OnTextChanged events from a <asp:repeater
> component and getting details about the values from the other controls of
> the <ItemTemplate> line that caused the event to trigger?
>
>
>
> Thanks in advance
>
>
>

Bookmark and Share