SearchBox_TextChanged

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am building a asp.net 1.1 phone directory that I want to search names as
soon as a user inputs values to a textbox called "SearchBox".

Example: I enter an “r†all names start showing, then “o†and all “ro†names
and so forth. I am assuming the best way to accomplish this is by populating
a dataset and search from the dataset.

Unfortunately this is not happening and will only search when enter is
pressed.

Any suggestions or recommendations?
 
That is a server side event. So until the user does something to make the
page post back to the server, the event won't run.

If you need it to post immediatelly, you will need client side javascript
code to initiate a postback.

Please remember that this is all happening in a completely disconnected
environment. There is a client side part and a server side part. It all
works quite differently from windows forms.
 
If you have wired to the TextChanged event you can add a function to the
text box that will postback on every key up.

txtSearchBox.Attributes.Add( "onkeyup", "javascript:
document.forms[0].submit();");

This will cause a postback everytime a key is lifted from the keyboard.
However, I don't think this is what you are looking for as it will postback
every time they enter a key. If they enter "ro", it would take the r.
Postback and do its thing then show the ro on the screen, then postback
again before the first processing is done. Just beaware of the behavior of
it during testing.

bill
 
I believe this will be a pretty neat Web App once I get it to work.
Basically this is for an Intranet, which is using SQL server that runs a job
to popolate a database of all employees from a DB2 database.

I saw a VB app that worked like this, and want the ASP.NET app to act the
same.

William F. Robertson said:
If you have wired to the TextChanged event you can add a function to the
text box that will postback on every key up.

txtSearchBox.Attributes.Add( "onkeyup", "javascript:
document.forms[0].submit();");

This will cause a postback everytime a key is lifted from the keyboard.
However, I don't think this is what you are looking for as it will postback
every time they enter a key. If they enter "ro", it would take the r.
Postback and do its thing then show the ro on the screen, then postback
again before the first processing is done. Just beaware of the behavior of
it during testing.

bill

Moojjoo said:
I am building a asp.net 1.1 phone directory that I want to search names as
soon as a user inputs values to a textbox called "SearchBox".

Example: I enter an "r" all names start showing, then "o" and all "ro" names
and so forth. I am assuming the best way to accomplish this is by populating
a dataset and search from the dataset.

Unfortunately this is not happening and will only search when enter is
pressed.

Any suggestions or recommendations?
 
Back
Top