-
February 28th, 2011, 01:53 AM
#1
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
-
March 1st, 2011, 07:45 AM
#2
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|