tabbing and loading tables when textbox key is pressed?!?!

G

Guest

Hi all,
Could someone please explain to me how i could load a different datagrid or
fill out all the textboxes with feilds from a database - once a user types a
character in a textbox.
I have the code for it, but my problem is that it doesn't work unless i
click on an empty button, just to reload the page...
also how would i control the direction of the tabbing on my ASP.Net webpage???
Thanks,
adam
 
W

William F. Robertson, Jr.

You can cause the textbox to postback for the "onkeyup" event. This method
will fire everytime the user releases a key on the keyboard when the text
box has focus.

txtEntry.Attributes.Add( "onkeyup", this.GetPostBackClientEvent( txtEntry,
"" ) );

You can then wire to the TextChanged event on the TextBox to ensure that the
postback was caused by the text changing and do you loading and datagrid
stuff.

Are you sure you just don't want to wire to the TextChanged event and turn
on AutoPostBack for the TextBox. This will cause a postback when the user
tabs out of the textbox and the text has changed. With the approach above,
if the user types "hello", there will be 5 postbacks of which the user will
probably only see the last one, depending on how fast your server is.

If you are running a query based on what they typed in, you might have 5
queries run, but only the last query is the one you want, thus increasing
load on your database.

HTH,

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top