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

i guess u can use webservices to achive this functionality

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

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.TextBox1.AutoPostBack = True
    End Sub

Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If (Me.TextBox1.Text = "whatever text required") Then
            Me.TextBox2.Text = "whatever text should appear in 2nd text box"
        End If
    End Sub

This should work. Try it

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-

"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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.