Ajax DropDownList

  • Thread starter Thread starter Chris Fink
  • Start date Start date
C

Chris Fink

I have a general question regarding VS2008 and Ajax Toolkit 3.5.

Currently I have a dropdownlist populated from the database. When the user
selects and item, the OnSelectedIndexChanged event fires (does a postback to
the server) and then loads the selected item's value into an asp:textbox
control. Using the Ajax toolkit, I'd like to perform this same
functionality, but without the entire page posting back. I'm looking for
suggestions on how to do this or any links to examples. Thank You
 
no ajax or postback is required for this, just a simple one liner in
javascript. (server side could be one line also)


string script = myTextBox.ClientID + ".value=this.value;";
myDropdown.Attributes["onchange"] = script;

-- bruce (sqlwork.com)
 
If for whatever reason you do need to go to server, you don't need the
Toolkit. Rather use standard ajax controls that come out of box with VS2008:

<asp:ScriptManager ID="ScriptManager" runat="server" />
<asp:UpdatePanel runat="server" ID="UpdatePanel">
<ContentTemplate>
<asp:DropDownList ...>
<asp:TextBox ...>
</ContentTemplate>
</asp:UpdatePanel>

Program the server side in a regular way.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


bruce barker said:
no ajax or postback is required for this, just a simple one liner in
javascript. (server side could be one line also)


string script = myTextBox.ClientID + ".value=this.value;";
myDropdown.Attributes["onchange"] = script;

-- bruce (sqlwork.com)

Chris said:
I have a general question regarding VS2008 and Ajax Toolkit 3.5.

Currently I have a dropdownlist populated from the database. When the
user selects and item, the OnSelectedIndexChanged event fires (does a
postback to the server) and then loads the selected item's value into an
asp:textbox control. Using the Ajax toolkit, I'd like to perform this
same functionality, but without the entire page posting back. I'm
looking for suggestions on how to do this or any links to examples.
Thank You
 
Back
Top