textbox suggest

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2007
Posts: 33
Reputation: ansari.wajid is an unknown quantity at this point 
Solved Threads: 0
ansari.wajid ansari.wajid is offline Offline
Light Poster

textbox suggest

 
0
  #1
Jul 25th, 2008
Hi friends

First of all I would like to thank people here on Daniweb for helping me whenever I need help. I am hopefull that now also all of you will help me. Today I got a special scenario which I am applying in my application.
I have 2 text boxes to enter zipcode, In first text box when ever user enters some data and presses tab and on getting focus on the second textbox, the second textbox must show data based on the values entered in the first textbox like what we see in google suggest.
For example when user enters 5 digit zipcode in 1st textbox & presses tab key the focus will be on 2nd textbox and immediately 2nd textbox must show names of peoples based on the zipcode entered in 1st textbox, like how we see in google suggest.
For further clarification please mail me back. Hope some one will help me. Thanks in advance

Thanks
wajid
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: textbox suggest

 
0
  #2
Jul 26th, 2008
i guess u can use webservices to achive this functionality
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 10
Reputation: @bhi is an unknown quantity at this point 
Solved Threads: 0
@bhi @bhi is offline Offline
Newbie Poster

Re: textbox suggest

 
0
  #3
Jul 26th, 2008
I think this can be done by setting autopostback of the 1st text box to true.

  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2. Me.TextBox1.AutoPostBack = True
  3. End Sub
  4.  
  5. Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  6. If (Me.TextBox1.Text = "whatever text required") Then
  7. Me.TextBox2.Text = "whatever text should appear in 2nd text box"
  8. End If
  9. End Sub

This should work. Try it
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 169
Reputation: tuse is an unknown quantity at this point 
Solved Threads: 14
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: textbox suggest

 
0
  #4
Jul 27th, 2008
Umm... I think you should maintain a database of 'suggests' for showing them in the 2nd TextBox

As @bhi said, enable the autopostback property for the 1st textbox and do this-

  1. "Select * from <table> where <field> like" & me.textbox1.text & "%"

This sql is for the 'suggests'. If you need some other field, just modify your sql statement.

Bind the result of this query to your multi-line 2nd textbox.

You can do this in AJAX too.
Last edited by tuse; Jul 27th, 2008 at 7:04 am. Reason: Typo
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC