1

I'm working on a Sharepoint 2010 project where I'm required to offer functionality for the end user to change the styles of web parts on an individual basis.

How would I go about adding a new setting (potentially a dropdown) so the user can change the colour of any type of web part added to a page. My initial thought would be to display this in the web part properties but I suppose it could be added to the ribbon if that's easier.

Is it possible to do this so that any web part will have this new option?

Any suggests appreciated

Thanks

2
  • Where would you want to have this setting? In the Web Part Settings dialog or would you develop something custom? Commented Oct 10, 2012 at 6:40
  • Web part settings seems like the most logical place.
    – user1162591
    Commented Oct 10, 2012 at 8:26

1 Answer 1

0

When it comes to this kind of adaptations the storage of the custom data that should be personal is the tricky part.

I'd create a custom list capable to contain the settings you want to change. If you have a lot of different settings in a lot of different webparts one settings list will most likely not be an option, in such case you may have to create a setting list for each web part.

  • If a user haven't made any customizations always ensure there are fallback values

I'd say the rest if fairly simple. Le me know if you need any help.

4
  • I agree with your suggestion of using a list and to be honest, there will only be one setting so that should be fairly straight forward. I guess where my knowledge lacks is the implementation within the web part settings - how do I go about adding new custom code that all web parts will inherit?
    – user1162591
    Commented Oct 10, 2012 at 8:28
  • If you are going to have a property setting (like background-color) that all web parts on a site shall inherit the property must be stored centrally. Having this setting as a web-part setting is pretty simple. If this is what you want I may have the time to write an example in a few hours but please confirm that my assumption is correct :) Commented Oct 10, 2012 at 12:07
  • Yes this is exactly what I'm looking for - a global setting across all web parts. The idea is to then set a class on the selected web part to change it s colour. Many thanks for your help :-)
    – user1162591
    Commented Oct 10, 2012 at 12:42
  • 1
    Just to add - this doesn't need to be personalisable on a per-user level - it will only be configured by admin and standard users will see the selected style.
    – user1162591
    Commented Oct 10, 2012 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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