Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > <newbie> problem with updatepanel and trigger

Reply
Thread Tools

<newbie> problem with updatepanel and trigger

 
 
Jeff
Guest
Posts: n/a
 
      11-12-2008
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:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Images/Go.gif" />
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ListBox Width="200" ID="ListBox1" runat="server">
</asp:ListBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtTextBox1"
EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      11-12-2008
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:ImageButton ID="ImageButton1" runat="server"
> ImageUrl="~/Images/Go.gif" />
> </td>
> </tr>
> <tr>
> <td>
> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
> <ContentTemplate>
> <asp:ListBox Width="200" ID="ListBox1" runat="server">
> </asp:ListBox>
> </ContentTemplate>
> <Triggers>
> <asp:AsyncPostBackTrigger ControlID="txtTextBox1"
> EventName="TextChanged" />
> </Triggers>
> </asp:UpdatePanel>
> </td>
> </tr>
> </table>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggering an UpdatePanel with a trigger located outside of the UpdatePanel Nathan Sokalski ASP .Net 1 06-15-2009 06:23 PM
UpdatePanel trigger in different usercontrol. zb ASP .Net 1 11-08-2007 07:34 AM
UpdatePanel Trigger - DefaultButton in ASCX Problem... koraykazgan Software 0 08-14-2007 02:46 PM
refresh an updatePanel in an other updatePanel fran_j_diaz@yahoo.fr ASP .Net 3 08-08-2007 06:30 AM
trigger updatepanel from gridview button =?Utf-8?B?Sm9l?= ASP .Net 0 08-08-2007 05:02 AM



Advertisments