Home All Groups Group Topic Archive Search About

Textbox inside a repeater. how to access datarow in post back event.

Author
10 Jun 2005 9:40 AM
guoqi zheng
Dear sir,

I have a textbox inside a repeart control, autopostback set to true for that
textbox. When the value of this textbox changes, I need to access current
row and update database.

Repeater is bind to a dataset. VS.NET generate a below event on double click.
However, I did not see any way to access current row.

Public Sub TxtQuantity_TextChanged(ByVal sender As Object, ByVal e As System.
EventArgs)

       response.write("it is here")

End Sub

How can access the datarow on repeater for that event???

regards,

Guoqi Zheng
http://www.ureader.com

Author
10 Jun 2005 11:59 AM
Teemu Keiski
Hi,

that data row item (DataRowView in this case) exists only when dataBind is
called (on the same request after you call dataBind for the control) and due
to performance reasons it doesn't exist at postback (the repeater row
controls are recreated on postback and viewstate restored to them)

You could store IDs of the row into the repeater's row (item) with TextBoxes
or literal controls having Visible="False" so that they'd be carried with
the ViewState. When you need the keys, locate the controls in the same row
(you can access the RepeaterItem via TextBox's NamingContainer property) and
read the keys from them.

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


Show quoteHide quote
"guoqi zheng" <n*@sorry.com> wrote in message
news:2bce2150a72d4797a5c728dc35e483a7@ureader.com...
> Dear sir,
>
> I have a textbox inside a repeart control, autopostback set to true for
> that
> textbox. When the value of this textbox changes, I need to access current
> row and update database.
>
> Repeater is bind to a dataset. VS.NET generate a below event on double
> click.
> However, I did not see any way to access current row.
>
> Public Sub TxtQuantity_TextChanged(ByVal sender As Object, ByVal e As
> System.
> EventArgs)
>
>       response.write("it is here")
>
> End Sub
>
> How can access the datarow on repeater for that event???
>
> regards,
>
> Guoqi Zheng
> http://www.ureader.com

Bookmark and Share