N
Newbie
I created a User Control, called in an Asp.Net page.
First, I've registered the control at the top of the page:
<%@ Register TagPrefix="uc1" TagName="MyUC" Src="MyUC.ascx" %>
Then, placed the control, as follows:
<uc1:MyUC id="MyUC1" runat="server" TitleText="My custom text"></uc1:MyUC>
The TitleText property is a custom property in the control that alters the text of a label web control inside of the user control, which works fine if I type text directly into the html-source portion of the web page; however, I would like to alter this text dynamically in the code-behind in the Page_Load method, dependent on a variable passed in from another link.
When I try to do something to the effect of either
MyUC1.TitleText = strCustomTextVariable
OR
uc1.TitleText = strCustomTextVariable
I get the following error:
Name MyUC1 is not declared
When I try MyUC.TitleText = strCustomTextVariable, I get
Reference to a non-shared member requires an object reference.
How would I go about doing this? Thanks in advance.
First, I've registered the control at the top of the page:
<%@ Register TagPrefix="uc1" TagName="MyUC" Src="MyUC.ascx" %>
Then, placed the control, as follows:
<uc1:MyUC id="MyUC1" runat="server" TitleText="My custom text"></uc1:MyUC>
The TitleText property is a custom property in the control that alters the text of a label web control inside of the user control, which works fine if I type text directly into the html-source portion of the web page; however, I would like to alter this text dynamically in the code-behind in the Page_Load method, dependent on a variable passed in from another link.
When I try to do something to the effect of either
MyUC1.TitleText = strCustomTextVariable
OR
uc1.TitleText = strCustomTextVariable
I get the following error:
Name MyUC1 is not declared
When I try MyUC.TitleText = strCustomTextVariable, I get
Reference to a non-shared member requires an object reference.
How would I go about doing this? Thanks in advance.