Ajax DropDownList

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
 
B

bruce barker

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)
 
E

Eliyahu Goldin

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
 

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

Top