473,473 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capturing TextChanged event in a datagrid

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!
Nov 22 '05 #1
4 7087
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

Nov 22 '05 #2
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?

"Michelle" wrote:
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

Nov 22 '05 #3
Hello,

It's exactly what I use for a textbox inside of a datagrid so I know it
works. If it's not working for you let me know what errors you are
getting.
Here's a very informative site for datagrids:

http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

Nov 22 '05 #4
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!

"Michelle" wrote:
Hello,

It's exactly what I use for a textbox inside of a datagrid so I know it
works. If it's not working for you let me know what errors you are
getting.
Here's a very informative site for datagrids:

http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabrício de Novaes Kucinskis | last post by:
Hi all, I have a combobox control, in wich I put an autocomplete code. This code is in the TextChanged event, but when this event fires, the Text property isn't updated yet. For example, if...
2
by: anna | last post by:
I posted a question earlier asking whether you can assign information to a textbox within a datagrid on PageLoad? If so, how? Have another question, is it possible to have a TEXTCHANGED method...
3
by: Bruce HS | last post by:
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...
4
by: Francesco | last post by:
Hi all, I am trying to make a UserControl with a TextBox in it. I have to publish the TextChanged event of the inner TextBox, but I have some trouble. If I declare : public event EventHandler...
2
by: jorge | last post by:
Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2. TextBox.TextChanged { WasButtonClickFired?
1
by: Samuel Chan | last post by:
I used the textchanged event of textbox and set the autopostback property to true. The textchanged event should fire when the content of the textbox is changed and user tab out of the textbox...
2
by: gaurav | last post by:
hi, I have a problem, How do i use TextChanged Event by clicking on Button. When i changed the text in text box and moving the focus from there then it is working but i have one calender popup...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
4
by: Jason Huang | last post by:
Hi, In my C# Windows form MyForm I have some TextBoxes. In these TextBoxes, we have to detect if the TextChanged event occurs, if there're changes in these TextBoxes, it will ask if we want to...
1
by: jeeber | last post by:
I saw this on another thread (Francesco November 15th, 2005 UserControl.TextChanged) but I didn't see how to add to the discussion, so I'm just starting a new one and hope that people find it. The...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.