Controlling ascx properties in .cs
Hello, I am using a ascx control to style properties in a asp.net website. There are multiple aspx pages that use this ascx control. Is there a way that I can change properties of the ascx page using the current page's aspx.cs file?
For example: (in ascx)<asp:Label Text="Hello" ID="helloText" runat="server"/>
(in index.aspx.cs) if("some 'if' statement")
helloText.Text="Goodbye";
My .cs files currently do not recognize the ascx attributes. Is this even possible? Thanks
Re: Controlling ascx properties in .cs
You need a property in your usercontrol (.ascx) to set the value of your label.
Then call that property from your page (.aspx) using the ID you gave the usercontrol.