views:

152

answers:

1

I'm employing a custom webpart that is made by an unaffiliated third party. I've created a feature which adds this webpart to a page. It's working mostly fine, except that I can't figure out the name of a specific property that needs to be defined. I tried obvious ones that match the display name on the tool pane view, adding the company's name in front of said display name, and many similar permutations. All of which to no avail. I would much prefer to include the property to the feature, as this will be necessary to deploy across multiple sites in the future. Manually configuring it every time will be a pain for my client.

The short, obvious answer is "Ask the third party". This can potentially work, particularly for this specific one (it is a CodePlex webpart and the author has posted a comment as recent as last week). But my experience with previous third party solutions has been less than optimal, usually even getting no response until they ask me three weeks later if I still like their product. So, since this is not always a reliable method to obtain this information, I was thinking the best option is to find out a way to figure out the name of properties in a webpart that I can use not just with this particular one, but in all future situations.

I did check out this earlier question which addresses a similar topic. However, I don't have access to the class for the webpart so I can't just find a convenient property in the code to modify. Or, at least, if I do have access to it in some fashion, I'm certainly unaware of it.

Thank you in advance!

+1  A: 

From what I understand, you are trying to set a certain webpart property for which you do not know the corresponding XML attribute name.

Did you try to export the web part? One possible check might be to try to export the webpart to see what properties come up in the webpart XML. If it is a common property, chances are the webpart XML will have that property already defined with no value e.g.

<data>
   <properties>
     <property name="Your property Name" type="yourType"></property>
   <properties>
</data>

To export the webpart, go to Edit Page mode, click the down arrow on the webpart and choose Export.

Also, if you have the webpart code in a dll, can you use reflector to open it and see what properties are being set in code?

Hope this helps.

desigeek
@desigeek I tried exporting the webpart. Which does give a lot more than when I just looked at the XML in the webpart gallery, so definitively a +1 for that. But unfortunately, the property appears to not be defined, even when I have manually filled it out. Maybe this webpart is an oddball amidst other ones.I do not (knowingly) have the webpart code in a DLL, but I'm pretty sure it's in the GAC in order for it to work. What is Reflector and how can I use it to examine the DLL? A simple link will do.
ccomet
Reflector is a tool that allows you to open and examine any .net framework compliant dll. So you can get that dll from the gac, and use reflector to open it. Then navigate to the class for the webpart and examine the webpart code to find out where and how the property is set. You can download the free version from www.red-gate.com/products/reflector/
desigeek
I'm appalled that I've gotten as far as I have for as long as I have without a tool like that.
ccomet
To my dismay, while I got the property through Reflector, it appears that I can't configure it through the XML. I'll have to add a receiver or summat with an SPLimittedWebPartManager to fix it up. Though the problem isn't solved, the question itself is indeed answered, so I'll still mark this as accepted.
ccomet