Use textbox to filter a DropDownList

Discussion in 'ASP .Net Web Controls' started by Rob, Mar 20, 2007.

  1. Rob

    Rob Guest

    Hi,
    I'm trying to duplicate a page from Classic ASP to ASP.Net 1.1.
    In Classic ASP, I have a <select> box populated by a recordset that
    holds a list of parts and I have a textbox and when I enter a part
    number in this text box...I have a javascript onchange event that calls
    a javascript function that selects the proper part from the select box
    as you type.

    My question is how is this done in .Net 1.1. I have a textbox and a
    DropDownList (which is populated by a DataReader) and I thought I would
    use the "OnTextChanged" event and filter the dropdownlist however this
    requires a postback.

    I'm using Visual Studio 2003 so I don't have access to AJAX.
    Does anyone know where I can find a tutorial on how to do this?
    I need to filter the correct part as I type each keystroke.

    Thanks
    Rob



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Rob, Mar 20, 2007
    #1
    1. Advertising

  2. Rob

    Rob Guest

    Error in my previous post.
    I am using the onKeyUp event to trigger the filtering of the dropdown
    list...no the onchange event.

    Rob



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Rob, Mar 20, 2007
    #2
    1. Advertising

  3. Rob

    Rob Guest

    Found the Answer!
    In case anyone else wants to know...

    I kept the same Javascript function and added it to my .Net App and
    added this next line of code in my Page_Load Sub.

    txtSearch.Attributes.Add("onkeyup", "lookupECC(document.Form1.txtSearch,
    document.Form1.ddlSearchResults);")

    Fixed!
    I guess it has to be done in Javascript as .Net doesn't support an
    onKeyUp event for the textbox.



    Rob



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Rob, Mar 20, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RockNRoll
    Replies:
    1
    Views:
    3,467
    Raterus
    Aug 2, 2004
  2. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,336
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  3. Replies:
    4
    Views:
    421
    Jon Paal [MSMD]
    May 30, 2007
  4. zax75
    Replies:
    1
    Views:
    1,133
  5. Li Pang

    Use dropdownlist as textbox

    Li Pang, Aug 8, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    147
    Dan Christensen
    Aug 10, 2006
Loading...

Share This Page