<newbie> problem with updatepanel and trigger

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff

    <newbie> problem with updatepanel and trigger

    hi

    asp.net 3.5 (project upgraded from asp.net 2.0).
    are using vwd2008 express now

    This is my first ajax attempt. The code below shows a TextBox and a ListBox.
    The idea I was trying to accomplish was that the items in the ListBox was
    automatically filtered as the user type text into the textbox... But nothing
    happens. The OnTextChanged event isn't even fired when I type in the
    textbox.

    Any suggestions?

    <table style="width: 100%;">
    <tr>
    <td>
    <asp:TextBox ID="txtTextBox1 " Width="190"
    OnTextChanged=" OnTextChanged" runat="server"> </asp:TextBox>
    <asp:ImageButto n ID="ImageButton 1" runat="server"
    ImageUrl="~/Images/Go.gif" />
    </td>
    </tr>
    <tr>
    <td>
    <asp:UpdatePane l ID="UpdatePanel 1" runat="server">
    <ContentTemplat e>
    <asp:ListBox Width="200" ID="ListBox1" runat="server">
    </asp:ListBox>
    </ContentTemplate >
    <Triggers>
    <asp:AsyncPostB ackTrigger ControlID="txtT extBox1"
    EventName="Text Changed" />
    </Triggers>
    </asp:UpdatePanel >
    </td>
    </tr>
    </table>


  • bruce barker

    #2
    Re: &lt;newbie&g t; problem with updatepanel and trigger

    OnTextChanged is a serverside event. it will only be fired on a
    postback. you can put autopostback on a textbox to auto fire a postback,
    but this will only happen when the client side onblur happens (focus
    leaves textbox).

    to reload the listbox as the users types will require you write client
    script that is attached to the clientside onkeypress event. this code
    should then do an ajax call to update the list. the update panel is
    probably overkill for this, I'd just have the javascript do a webservice
    call and reload the list in client script.

    google combobox controls and you will get a lot of sample javascript.
    the ajax control toolkit has similar control. this would probably be
    covered in any javascript book.

    -- bruce (sqlwork.com)


    Jeff wrote:
    hi
    >
    asp.net 3.5 (project upgraded from asp.net 2.0).
    are using vwd2008 express now
    >
    This is my first ajax attempt. The code below shows a TextBox and a ListBox.
    The idea I was trying to accomplish was that the items in the ListBox was
    automatically filtered as the user type text into the textbox... But nothing
    happens. The OnTextChanged event isn't even fired when I type in the
    textbox.
    >
    Any suggestions?
    >
    <table style="width: 100%;">
    <tr>
    <td>
    <asp:TextBox ID="txtTextBox1 " Width="190"
    OnTextChanged=" OnTextChanged" runat="server"> </asp:TextBox>
    <asp:ImageButto n ID="ImageButton 1" runat="server"
    ImageUrl="~/Images/Go.gif" />
    </td>
    </tr>
    <tr>
    <td>
    <asp:UpdatePane l ID="UpdatePanel 1" runat="server">
    <ContentTemplat e>
    <asp:ListBox Width="200" ID="ListBox1" runat="server">
    </asp:ListBox>
    </ContentTemplate >
    <Triggers>
    <asp:AsyncPostB ackTrigger ControlID="txtT extBox1"
    EventName="Text Changed" />
    </Triggers>
    </asp:UpdatePanel >
    </td>
    </tr>
    </table>
    >
    >

    Comment

    Working...