Search code examples
c#asp.netascx

Pass a value from aspx to ascx


I have a web page and it contains an user control inside of it. I have a property on the aspx page which gets set in the pageinit method and I need to that propery on ascx page. How can I get it?


Solution

  • Create a public property inside the ascx and set it at the same time you set in the aspx page.

    Just to let you know, PreInit is a EventHandler not a method.