I am having an issue solving this problem.

I have a RichHtmlField, date selectors, and geographical location dropdownlist. (A list of cities). I need to be able to edit a page and create content for different locations. How do I create the data, so that when a user visits the page, it can pull up the data based on their geographical location.

I have the location of the user. I'm just not sure how to use that information to get the location specific content out of sharepoint.

Thanks. TR


If you simply have location as city then you can have a list for location information. If you are talking about having Latitude, Longitude coordinates then you can associate each page with those fields. Depends what you are trying to do.

If you just have cities as a choice field on page then you can have a list for city specific information and you can have a web part which displays the information depending on choice. I would have a enum property on the web part toselect a city and then web part can query the list using CAML to get the information by that city.

  • Of course if you want a publishing layout page with site colmuns and a content type etc, than you will require a custom field to retrieve city specific information. You can have a custom field that retrieves and displays city psiecific information from a list on selecting a choice from field. Here is a custom field example getting items from a list, you can use similar approach to get your city specific information. msdn.microsoft.com/en-us/library/bb684919(v=office.12).aspx Jul 20 '12 at 16:45
  • Is it possible to also include a date range, so that content is shown by city and date range? Jul 20 '12 at 16:59
  • Yes with a custom field you can do this. Your field can have a date picker and a city dropdown and once you select values it can query the list you are holdin information and get the result as its value. Your data would be a list with columns for city and date and you can use a CAML query to get the information by city and date using the <WHERE> claus in CAML. For this you might show date picker and city dropdown with a button to get value and your Display mode can simply display it to the UI. Once you develop this field you can use it as a normal field on page. Jul 20 '12 at 17:02
  • I understand what you are saying. The only issue is that the site admin needs to edit the content of the RichHtmlField when the page is put in 'Edit' mode, and by selecting a location and date range update the content. How would I address this issue? Jul 20 '12 at 17:18
  • 1
    What you can do is in edit mode your field renders a date picker, a dropdown for cities and a textbox (InputFormTextBox). When you select soething in dropdown or change date it gets fresh entry from the list and puts it in the InputFormTextBox. Here user can edit wat is in InputFormTextBox. Then on save the field persists what is in InputFormTextBox. Your Display Mode shows this and when Edit Mode opened again this persisted entry will be displayed in InputFormTextBox. Here is a link I found showing how to use it: amitkumarmca04.blogspot.co.uk/2010/10/… Jul 20 '12 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.