Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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