Capturing TextChanged event in a datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I do an autopostback from a text box in a datagrid template. How can I
capture the event in the code behind? Handles
DataGrid1.textboxname.TextChanged doesn't work, and I don't see any DataGrid
events appropriate for a textchanged event.

Please respond, and save me a $245 support call to MS!
 
Hi Bruce,

Here's an example of what I use in one of my web apps:


HTML
----------
<asp:TextBox OnTextChanged="txtCPL_TextChanged" AutoPostBack=True
id="txtCPL" runat="server" .....> </asp:TextBox>


CODE BEHIND
----------------------
Protected Sub txtCPL_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
Try
'do your stuff
Catch ex As Exception
'error handling
End Try
End Sub



Take care,
Michelle
 
I believe your technique works only for a textbox standing free on the page.
When the textbox control is part of an item template inside a datagrid, my
experience is that the codebehind does not find the textbox to allow the
textchanged event.

Do you believe your method will work on a textbox inside a cell in a datagrid?
 
Thank you for getting me to look at your code more closely. I realized I
needed to put the OnTextChanged="txtCPL_TextChanged" string manually into my
HTML. That works.

THANK YOU!
 
Back
Top