Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Use of AJAX in SharePoint

  Asked By: Krista    Date: Oct 02    Category: Sharepoint    Views: 1292

Has anyone tried using AJAX in SharePoint? I have a web
part with two dropdownlists. One dropdownlist will have the country
names as values and the other dropdownlist will be populated
with "State" values based on the selected country in the first

Basically, the second dropdownlist will be populated
with "State" values based on the selected "Country" value in the first
dropdownlist. And I want this to happen using AJAX, so that the page
is not posted back but the action takes place by retrieving values
after requesting the server.



1 Answer Found

Answer #1    Answered By: Stefanie Ruiz     Answered On: Oct 02

Depends on what you need, you might use Html control
with Javascript in your web part to achieve the
purpose without touching AJAX.

The basic idea is that the CreateChildControl() method
create all Html controls with embedded logic in the
JavaScript functions (onclick, onchange etc.). The
CreateChildControl() method also loads server  side
information to be used in Html controls and JavaScript
functions. But once that is done, everything else is
controlled by the JavaScript which runs on the client

The code can look very ugly.

And it won't work if client needs to interact with
server later because it is hard (impossible without
AJAX?) to get value from an Html control to a web
control. I believe AJAX will come in handy. I hope
someone else will share her/his experience.

Didn't find what you were looking for? Find more on Use of AJAX in SharePoint Or get search suggestion and latest updates.