Searchable TextBox using window.showModalDialog

Discussion in 'ASP .Net' started by dan_williams@newcross-nursing.com, Jun 6, 2006.

  1. Guest

    I'm trying to create a textbox control on an asp.net web page, that
    after a user has typed some text into it, another pop-up window appears
    with a dropdownlist populated with options related to the text the user
    entered.

    My initial attempt was to create a javascript function that executes on
    the onblur event of my textbox. My javascript function is as follows:-

    function fnClient() {
    var tURL = "modGetClient.aspx?client=" + Form1.client.value;
    var tSearch = window.showModalDialog(tURL);
    Form1.tClientId.value = tSearch;
    Form1.submit();
    }

    My modGetClient.aspx page simply executes the following SQL statement
    and populates a dropdownlist with all the resulting records. Once the
    user clicks on an OK button, a javascript function sets the
    window.returnValue to the selected option and the window gets closed.

    SELECT ClientId FROM Clients WHERE BusinessName LIKE '%" +
    Request("client") + "%' "

    The tClientId is a hidden textbox value and I have server-side Sub
    tClientId_TextChanged that i need to fire when it gets set by my
    client-side fnClient function.
    The tClientId_TextChanged function basically populates other form
    fields based on the clientId selected from the modalDialog box.
    However, it only seems to fire after i actually physically type
    something in the hidden field (i made it a text type to test it).
    Therefore, i added the Form1.submit() function to force a postback, but
    this causes my validation controls to fire, which i don't want.

    Can anyone recommend a way of doing this? Am i going down the right
    route with a showModalDialog box? Is it possible to prevent page
    validation from happening? Is it possible to call a server-side
    function from client-side javascript?

    Please help!!!

    Dan
     
    , Jun 6, 2006
    #1
    1. Advertising

  2. Guest

    DOH!

    It's OK, i managed to work it out for myself. Instead of performing the
    Form1.submit(); i use __doPostBack('tClientId_TextChanged', '');

    Seems to work exactly as i require

    Thanks anyway

    Dan


    wrote:
    > I'm trying to create a textbox control on an asp.net web page, that
    > after a user has typed some text into it, another pop-up window appears
    > with a dropdownlist populated with options related to the text the user
    > entered.
    >
    > My initial attempt was to create a javascript function that executes on
    > the onblur event of my textbox. My javascript function is as follows:-
    >
    > function fnClient() {
    > var tURL = "modGetClient.aspx?client=" + Form1.client.value;
    > var tSearch = window.showModalDialog(tURL);
    > Form1.tClientId.value = tSearch;
    > Form1.submit();
    > }
    >
    > My modGetClient.aspx page simply executes the following SQL statement
    > and populates a dropdownlist with all the resulting records. Once the
    > user clicks on an OK button, a javascript function sets the
    > window.returnValue to the selected option and the window gets closed.
    >
    > SELECT ClientId FROM Clients WHERE BusinessName LIKE '%" +
    > Request("client") + "%' "
    >
    > The tClientId is a hidden textbox value and I have server-side Sub
    > tClientId_TextChanged that i need to fire when it gets set by my
    > client-side fnClient function.
    > The tClientId_TextChanged function basically populates other form
    > fields based on the clientId selected from the modalDialog box.
    > However, it only seems to fire after i actually physically type
    > something in the hidden field (i made it a text type to test it).
    > Therefore, i added the Form1.submit() function to force a postback, but
    > this causes my validation controls to fire, which i don't want.
    >
    > Can anyone recommend a way of doing this? Am i going down the right
    > route with a showModalDialog box? Is it possible to prevent page
    > validation from happening? Is it possible to call a server-side
    > function from client-side javascript?
    >
    > Please help!!!
    >
    > Dan
     
    , Jun 6, 2006
    #2
    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. Vadim

    Searchable Combobox In ASP.NET

    Vadim, Feb 25, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,643
    Alex Homer
    Feb 27, 2005
  2. Craig G

    Searchable ComboBoxes

    Craig G, Mar 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    343
    Teemu Keiski
    Mar 23, 2005
  3. kurt sune
    Replies:
    2
    Views:
    7,494
    imransyed63
    Aug 19, 2008
  4. Gilles T.
    Replies:
    1
    Views:
    182
    Jim Ley
    Jan 18, 2004
  5. Jonathan
    Replies:
    0
    Views:
    204
    Jonathan
    Jul 19, 2004
Loading...

Share This Page