1

How can I compare the value of my text box letter each time when i will be typing and place matching word in dropdhown in c#?

    <asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger controlid="txtBox" eventname="TextChanged" />
    </Triggers>
        <ContentTemplate>
             <asp:TextBox ID="txtBox" runat="server" OnTextChanged="TextBox1_TextChanged" Width="195px"AutoPostBack="true"></asp:TextBox>
             <br />
             <br />
             <asp:listbox ID="lstBox" runat="server" Width="202px"></asp:listbox>


        </ContentTemplate>
    </asp:UpdatePanel>**
2
  • i think you can achieve this using ajax. Commented Dec 3, 2014 at 13:09
  • yes i can but i want to make custom composite control as DLL so how i can put ajax control in composite custom control Commented Dec 3, 2014 at 13:14

2 Answers 2

2

Have a look at the AjaxControlToolkit's AutoComplete extender. It can do what you are seeking:

http://www.ajaxcontroltoolkit.com/AutoComplete/AutoComplete.aspx

The extender has a decent set of properties for controlling behavior and presentation.

Sign up to request clarification or add additional context in comments.

2 Comments

but i want to make as composite custom control so how we use Ajax in custom control...
Are you sure you need a Composite Control? Would a User Control suffice? You can use Ajax within Composite Controls. You're just going to have to build the controls programmatically, it's really not all that different than laying out controls in an ascx/aspx. You'll want to be sure to account for pre-exsiting/non-existant ScriptManagers in the parent application. Here's a good starting point on Ajax within Composite Controls: stackoverflow.com/questions/592614/…
2

Personally, I am not a fan of the AjaxControlToolkit. I think the final code it produces is bloated and yucky.

I think I understand what you are asking, but tell me if I am wrong. You give the user a textbox, and as they type, each keystroke is examined, and under the textbox, a dropdown appears with possible results that match what the user is typing. With each new letter that is entered into the textbox, the dropdown list is refined.

Do I have it right?

If so, I did the same thing a while back, and I followed this excellent step-by-step tutorial:

How to Implement Autocomplete textbox in ASP.NET WITHOUT using Webservice & AJAX autocomplete extender.

2 Comments

yes but i want to fetch values from Database not a list and any other source... but i will follow all the step in your comment thax......
The tutorial to which I link does, indeed, fetch values from a database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.