473,414 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

ASP.NET OnTextChanged issue

16
Hi,

I wonder if anyone has any ideas regarding the following issue I have.

I have a form with multple Textboxes. One of the Textboxes uses 'OnTextChanged' to retrieve information from a database using the information keyed into the Textbox.
My problem is that the user will click or tab to another Textbox, the data is retrieved successfully, but, when the form is available again, the textbox that the user clicked into is not in focus. This means that the user effectively has to click into this textbox twice.
I could set the focus of the next textbox from the ontextchange method, but I don't know which textbox the user actually tried to move into.
Dec 4 '08 #1
8 4518
Curtis Rutland
3,256 Expert 2GB
I don't know if this will help...but you might try using another thread to handle the data transfer. That way it doesn't lock up your GUI thread and miss the click on the textbox you want to enter.
Dec 4 '08 #2
AndrewK
16
Thanks for your reply. I'll give it a go.
Dec 4 '08 #3
Frinavale
9,735 Expert Mod 8TB
@insertAlias
I'm not sure if that will help in this case...since it's an ASP.NET application.

I would be more inclined to say that you should try placing the TextBox in an UpdatePanel so that it can make an asynchronous call back to the server to do it's processing....This will result in a partial page update (just the TextBox in this case).

-Frinny
Dec 4 '08 #4
Curtis Rutland
3,256 Expert 2GB
LOL, it's my turn to try reading for a change ;)
Dec 4 '08 #5
AndrewK
16
I've found a way that I can retrieve the name of the control that's received focus (by using a javascript function and storing the control name in a hidden field on the asp page). So I could issue a call to set the focus of this control after I've accessed the database. What I'm not sure about (because of my lack of knowledge of c#) is how to action the event on a control where i've only got a string of it's name. e.g. it the string is "TextBox2" I need to be able to call TextBox2.Focus(). Any ideas on how I can achieve this?
Dec 4 '08 #6
balabaster
797 Expert 512MB
I'll be interested to hear how you overcome this as I have the same problem in another application that I've not gotten as far as attempting to fix yet. So you might save me trying to figure out a fix for it :)
Dec 4 '08 #7
Frinavale
9,735 Expert Mod 8TB
@AndrewK
I used this technique in one of my web applications as well.

Did you try the UpdatePanel?

I'd be interested in knowing if that works....
Dec 4 '08 #8
AndrewK
16
Thanks for all your help. Just to let you know that I've actually gone for the asynchronous callback route which seems okay so far, and much slicker for the user. However, one thing to be aware of, which caught me out, is that if you set the 'value' on readonly fields, the data gets lost on postbacks. I ended up changing them to enabled=false instead.
Dec 6 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Henri | last post by:
Very strange problem : if I write: <asp:TextBox runat="server" id="myBox" /> the control's ViewState stays always empty, so it loses its properties if it's not always displayed. But if I...
3
by: Neil | last post by:
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...
3
by: kbrandl | last post by:
On my page, there is a textbox at the top that contains a date -- and a fully-editable datagrid below (each row in the datagrid contains an editable textbox, along with some other controls). The...
1
by: Alex Nitulescu | last post by:
Hi. I have created a web-based file manager. Now I'd like to watch a folder for changes, and when a change occurs I'd like to refresh my page. Okay. So I have created a FileSystemWatcher set on...
4
by: Chris | last post by:
I think I already know the answer to this but here goes. I've read the other postings but no solutions for this. If a user enters a textbox, there is no 'onenter', etc. to control firing off a...
1
by: mdipiet | last post by:
I've got a form that is supposed to validate data entry from a bar code scanner. The scanner is set up to add a carriage return at the end of the data in the barcode, which should fire the...
4
by: MattB | last post by:
Hi. I'm working on an intranet application that requires a user to input information about themselves. I have a user control with a couple of textboxes that I want the user to enter their weight...
0
by: RajS | last post by:
Hi All, I am trying to update datagrid, onTextchanged event, I dont know how to do this. please shed some light or any examples. Here is the code I am wrestling with. OnTextChanged event of...
1
by: Fred Dag | last post by:
As far as I can work out when using the OnTextChanged event I cannot get the TextBox and Labels values when the event fires as they are populated by a <asp:repeater and so don't have values. If...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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...
0
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
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...

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.