global variable for K12 MVC developement

innovix solutions asked on July 8, 2019 18:10

Hi All,

We want to read page form field data (ID,Code) from all of the widgets? Any suggestion on this?

Recent Answers


Roman Hutnyk answered on July 9, 2019 09:02

I think more details here would be really useful

0 votesVote for this answer Mark as a Correct answer

innovix solutions answered on July 9, 2019 09:49

  1. We need to get Name from page field entry from each and every widgets.
0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on July 9, 2019 10:41 (last edited on July 9, 2019 10:42)

Hi,

In the widget inherited from WidgetController you can use GetPage() method which will return the current page and you would be able to access it's fields (refer here for more info, works for both 12 and 12SP versions):

var page = GetPage();
var documentName = page.DocumentName;
2 votesVote for this answer Mark as a Correct answer

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