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 update
d
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 RowChange
d
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...>
erControl.asp
Thanks
NHi,
I've fixed this now, it seems that I must rebind the datagrid for this event
to fire. Not sure why but it works...
"Neil" wrote:
> 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 butto
n.
> I'm trying to use the OnTextChanged event to capture which rows where upda
ted
> before I update the DB. I have added the line OnTextChanged="RowChanged" t
o
> my text box control in the HTML and added the event handler called RowChan
ged
> to the code behind. Is there something else I need to do to make this even
t
> 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 fi
re,
> is this correct? I'm following the example
> http://msdn.microsoft.com/library/d...>
erControl.asp
> Thanks
> N
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,
Scott
http://www.OdeToCode.com/
On Tue, 5 Oct 2004 09:47:02 -0700, "Neil"
<Neil@.discussions.microsoft.com> wrote:
>Hi,
>I've fixed this now, it seems that I must rebind the datagrid for this even
t
>to fire. Not sure why but it works...
>"Neil" wrote:
>
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")
= "java script: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
"Neil" wrote:
> 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 butto
n.
> I'm trying to use the OnTextChanged event to capture which rows where upda
ted
> before I update the DB. I have added the line OnTextChanged="RowChanged" t
o
> my text box control in the HTML and added the event handler called RowChan
ged
> to the code behind. Is there something else I need to do to make this even
t
> 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 fi
re,
> is this correct? I'm following the example
> http://msdn.microsoft.com/library/d...>
erControl.asp
> Thanks
> N
0 comments:
Post a Comment