473,594 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ 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.textb oxname.TextChan ged 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 7102
Hi Bruce,

Here's an example of what I use in one of my web apps:
HTML
----------
<asp:TextBox OnTextChanged=" txtCPL_TextChan ged" AutoPostBack=Tr ue
id="txtCPL" runat="server" .....> </asp:TextBox>
CODE BEHIND
----------------------
Protected Sub txtCPL_TextChan ged(ByVal sender As Object, ByVal e As
System.EventArg s)
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_TextChan ged" AutoPostBack=Tr ue
id="txtCPL" runat="server" .....> </asp:TextBox>
CODE BEHIND
----------------------
Protected Sub txtCPL_TextChan ged(ByVal sender As Object, ByVal e As
System.EventArg s)
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_TextChan ged" 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
2922
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 the Text property is "Foo" and I press the letter "d", the Text property when the TextChanged event runs is "Foo". Only after the TextChanged event be processed, the KeyDown, KeyUp and KeyPress events fires and update the Text property.
2
454
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 for a textbox within the datagrid. Once again, how? I am trying to figure out whether I should continue on searching on how to do thing in a datagrid or just switch to something else. I can't seem to find solutions for those quations. THANKS
3
664
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 events appropriate for a textchanged event. Please respond, and save me a $245 support call to MS!
4
7095
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 TextChanged; I get a compiler error saying that TextChanged is already declared and I have to use : public new event EventHandler TextChanged;
2
2179
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
4500
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 control. However, textchanged event fires whenever there is a postback, even when I click a button that send postback. Can anybody tell we what change I should make so that textchanged event only fire when the content is changed?
2
3006
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 button, what i want is when i click on that button and remove the focus from tht button by hitting Tab the TextChanged Event should work.
5
4727
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 gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
4
29800
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 save the changes when we close the form. However, when I run the MyForm, it will fetch data from the system and put into TextBoxes, and this incurs the textchanged event. But I am thinking how do I make the TextBox's TextChanged know the
1
4032
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 original problem was creating a user control and trying to use existing event types like "TextChanged", if you were creating a control that was similar to a text box, for example. The problem was that the developers at Microsoft decided that this...
0
7947
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8255
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8010
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5413
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.