How to change the value of a control e.g. Literal in a user control and that User control is in master page and I want to change the value of that literal from content page.
((System.Web.UI.UserControl)this.Page.Master.FindControl("ABC")).FindControl("XYZ").Text = "";
Here ABC is user control and XYZ is Literal control.
The best solution is to expose the values through public properties.
Put the following into your
ABCcontrol that contains theXYZcontrol:Now you can expose this from the Master page by adding the following property to the MasterPage:
Then to use it from any content page, just do the following (where
MPis theMasterPageclass):