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

G

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
 
T

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top