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 Answer 1

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.

2
  • 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. Commented Mar 3, 2011 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]; Commented Mar 3, 2011 at 23:42

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.