<newbie> problem with updatepanel and trigger




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

Any suggestions?

<table style="width: 100%;">
<asp:TextBox ID="txtTextBox1" Width="190"
OnTextChanged="OnTextChanged" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Images/Go.gif" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:ListBox Width="200" ID="ListBox1" runat="server">
<asp:AsyncPostBackTrigger ControlID="txtTextBox1"
EventName="TextChanged" />



bruce barker

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)

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question