0
votes

there is EventCategory list at the root level with column "categoryname". I need to pull all the values of categoryname field and populate a dropdown field( HTML dropdown or asp.net dropdown list or whatever). The idea is when someone somewhere updates the list column, say adds a new category, it will also be reflected in the dropdown. So no one has to actually mess with the code to update the dropdown option. Is this possible without server coding?

I don't have access to the server. I can think of two ways it might be possible:

  1. Client-side for sharepoint; or
  2. bind spdatasource to ASP.NET dropdown list. Could anyone give me any ideas?
1

1 Answers

0
votes

I'd suggest a cientside solution where you use AJAX calls to retrieve list items via SharePoint's web services. It is quite easy to do if you use Darren Johntstones "SPAPI" library (a wrapper around Sharepoint ASMX web services). The original site is dead, but you can download it from a (slightly less documented) mirror: http://zer0c00l.in/wiki/index.php?title=SharePoint_SPAPI_HowTO

For instance, to load items from a list, you simply make such a JavaScript call:

var items = lists.getListItems('categories', 
'',  //default view
'<Query><OrderBy><FieldRef Name="ID"/></OrderBy></Query>', // CAML query 
'<ViewFields><FieldRef Name="Title"/></ViewFields>', 
0, // rowlimit (retrieve all)
'' // queryoptions 
);

Then you would have to parse the response XML, but this is quite easy.