943,569 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1603
  • ASP.NET RSS
Jul 25th, 2008
0

textbox suggest

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
ansari.wajid is offline Offline
47 posts
since Aug 2007
Jul 26th, 2008
0

Re: textbox suggest

i guess u can use webservices to achive this functionality
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007
Jul 26th, 2008
0

Re: textbox suggest

I think this can be done by setting autopostback of the 1st text box to true.

ASP.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 8
Solved Threads: 0
Newbie Poster
@bhi is offline Offline
10 posts
since Jul 2008
Jul 27th, 2008
0

Re: textbox suggest

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-

asp.net Syntax (Toggle Plain Text)
  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
Reputation Points: 32
Solved Threads: 14
Junior Poster
tuse is offline Offline
173 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How to send email to site Admin when a new user registers?
Next Thread in ASP.NET Forum Timeline: Versioning ASP.Net Website





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC