OnTextChanged not firing??

G

Guest

Hi,

I have a datagrid containing a number of item templates, inside of these
item templates I have various controls like the textbox. The user is able to
edit all the fields on the datagrid at once and then click an update button.
I'm trying to use the OnTextChanged event to capture which rows where updated
before I update the DB. I have added the line OnTextChanged="RowChanged" to
my text box control in the HTML and added the event handler called RowChanged
to the code behind. Is there something else I need to do to make this event
work?

My understanding is that this event does not get called until the page is
posted back, so I'm hoping that when I click the update button this event
will fire for all rows that have changed and then the update event will fire,
is this correct? I'm following the example
http://msdn.microsoft.com/library/d...QuestionsAboutASPNETDataGridServerControl.asp

Thanks
N
 
G

Guest

Hi,

I've fixed this now, it seems that I must rebind the datagrid for this event
to fire. Not sure why but it works...
 
S

Scott Allen

Hi Neil:

During binding the grid will create the textbox control. If the code
doesn't re-bind the datagrid, the grid doesn't create the textbox, and
if there is no textbox there is no object to 'fire' an event.

Hope that clarifies a bit,
 
G

Guest

Hi Neil ,
i have the same prolem as you but with one change the Ontextchanged property
i have i am adding it with the datagrid_ItemDataBound sub and if i rebeind
the grid i enter in a loop so do you have any suggestions????

here is my code

Sub ListAct_ItemDataBound(sender As Object, e As DataGridItemEventArgs)

'some other code here
CType(itemVal.Cells(1).Controls(1), textbox).Attributes("Ontextchanged")
= "javascript:return confirm('Are you sure?')"

End Sub


NB I have put this on the itemdatabound sub coz here is where the input box
is created when editing the grid
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top