2

Let's say I have a reference to a web part that I got by using a SPLimitiedWebPartManager. How can I set the custom properties of that web part? For example, if it is a stock ticker web part, how do I set the value of the stock symbol using the object model? Do I have to use reflection to accomplish this?

My goal is to be able to edit the properties of personal web parts using ajax instead of having to do all of the full round trips and post backs to the server.

1

Get the WebPart reference to the object (cast the type you're after), the properties for the web part should be exposed as any other object.

  • I suppose this would be easier than reflection, I was just hoping for some built in SharePoint way of handling this without reflection or casting. Thanks again. – TehOne Mar 3 '11 at 23:35
  • Well the SPLimitedWebPartManager can get you the WebPart object. Your WebPart will inherit from that class - so you just do something like MyWebPart webPart = mySPLimitedWebPartManager.WebParts[id]; – James Love Mar 3 '11 at 23:42

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.