Get Widget Instance properties in text/xml transformation

Naresh Ede asked on April 23, 2018 06:10

Hi Guys

I want to get widget instance properties in text/xml transformation.

Is that possible ?


Naresh Ede

Recent Answers

Peter Mogilnitski answered on April 23, 2018 12:22 (last edited on May 1, 2018 15:20)

Widgets are a bit different from web parts in terms of macro resolving.

To get the value of a property of the current web part, use only: {% PropertyFieldName %} {% WebPart.GetValue("WebPartControlID","PropertyFieldName") %} - gets the value of a web part's property. To identify the property, fill in the Web part control ID of the source web part and the Field name of the given property. You can find the field names of properties by editing web parts on the Properties tab in the Web parts application.

see documentation (scroll to Loading values from the properties of other web parts)

I think for widgets though you will have to call the resolver

If have web part static text and put into text property {%WebPartTitle%} - it will easily resolve for current instance. but for widget if we take (static html) I think you need to call MacroResolver.Resolve(Eval("FieldName").ToString()) in the code behind.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on April 25, 2018 14:38

You can normally in the webpart container.

However, I did create a transformable web part that does exactly this, it's on the marketplace, and passes your web part/widget properties into the transformation you set. Very convenient!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.