M
Mad Scientist
I am having problems setting a asp user control's property from code.
I have an asp.net page and have a user control "page_footer" which has
a property sFooterText. Here is the control:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="page_footer.ascx.vb" Inherits="Site1.page_footer"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script language="VB" runat="server">
Public sFooterText As String = ""
</script>
<table border="0" width="100%" cellSpacing="0" cellPadding="0">
<tr>
<td align="right"><font
class="copy"><%=sFooterText%></font> </td>
</tr>
</table>
The control is defined at the top of my aspx page as so:
<%@ Register TagPrefix="site1" TagName="page_footer"
Src="page_footer.ascx" %>
Everything works great when i set the property explicitly on the page,
such as:
<site1age_footer id="page_footer_1" runat="server"
sFooterText="Copyright 2004"></site1age_footer><br>
However if i try to set it from codebehind's Page Load with a line
such as:
page_footer_1.sFooterText = "Copyright 2004"
the "page_footer_1" is underlined in blue, with a message "Name
'page_footer_1 is not declared."
Help me, Obi Wan.
I have an asp.net page and have a user control "page_footer" which has
a property sFooterText. Here is the control:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="page_footer.ascx.vb" Inherits="Site1.page_footer"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script language="VB" runat="server">
Public sFooterText As String = ""
</script>
<table border="0" width="100%" cellSpacing="0" cellPadding="0">
<tr>
<td align="right"><font
class="copy"><%=sFooterText%></font> </td>
</tr>
</table>
The control is defined at the top of my aspx page as so:
<%@ Register TagPrefix="site1" TagName="page_footer"
Src="page_footer.ascx" %>
Everything works great when i set the property explicitly on the page,
such as:
<site1age_footer id="page_footer_1" runat="server"
sFooterText="Copyright 2004"></site1age_footer><br>
However if i try to set it from codebehind's Page Load with a line
such as:
page_footer_1.sFooterText = "Copyright 2004"
the "page_footer_1" is underlined in blue, with a message "Name
'page_footer_1 is not declared."
Help me, Obi Wan.