views:

52

answers:

3

hi 2 all,

I'm using asp.net 2005,

I have one textbox and datagrid. i want to change the datagrid when i entered some value in textbox.ok.

I know textchanged event is best ...but my question is

textchanged event fired only when i entered "enterkey or space or tab key"...

i want to fire when i enter the value without "enterkey or space or tab key"

if anybodies know pls tell.... (with sample code)

A: 

You might try the onkeyup (if that is what it is called, I can't remember) event.

Dan Iveson
thanks i got it
gopinathan
A: 

From MSDN (TextChanged event):

The TextChanged event is raised when the content of the text box changes between posts to the server.

This means that a postback is required for the event to fire.

You can cause a postback to be called by adding the autopostback="true" attribute to the control. This will cause a postback when the control loses focus.

Oded
The control has to loose focus (that means, that you _have_ to tab out or press enter). Otherwise, how do you know when someone has finished typing?
Oded
A: 

Textbox_change event is fired when you lost focus on textbox. If you want to change the contents of grid on every key press then you need to manually send __postBack through javascript.

But it will look really pathetic to end user that whenever he presses a key whole page is post back.

Either leave it as it is i.e. on lost focus, otherwise you have to use Ajax based service call and grid populate to implement this feature.

I can share you some articles if you want information about ajax based service calls.

Zeeshan Umar