set web part property from another web part

Mani SJ asked on November 9, 2020 04:53

I have two web parts(A,B). A has a link button in it. When I click the button I need to set a property of web part B and after setting it, somehow need to reload the web part B. Both web parts in same page. I followed link https://devnet.kentico.com/articles/how-to-change-the-properties-of-one-web-part-from-within-another-web-part they suggested to create a custom interface which my web part B would implement but not sure what needs to be in that interface. Using K12.Kindly assist.

Correct Answer

Juraj Ondrus answered on November 9, 2020 05:20

You can try using the code how to access properties of other we part on the same page template as described in the documentation (scroll little bit down to "Accessing the properties of other web parts"). Or, as described in the article you linked - store the value as a flag in the request or in the session variables and do a postback to reload the page and when reloading, read this flag.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Mani SJ answered on November 9, 2020 05:26

@Juraj Ondrus thanks.I will try both ways.

0 votesVote for this answer Mark as a Correct answer

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