[thelist] .NET: Public variable set in user control
Tab Alleman
talleman at Lumpsum.com
Thu Oct 12 11:08:51 CDT 2006
Are you declaring and instantiating Navigation1 in your code-behind?
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Casey Crookston
> Sent: Tuesday, October 10, 2006 1:44 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] .NET: Public variable set in user control
>
>
> Ok, according to page 260 of ASP.NET Unleashed (1.1), "All public
> variables declared in the user control file are exposed as
> properties of
> the user control." So I have a user control called
> navigation.ascx. In
> navigation.ascx.vb I declare a public variable called
> ImageToDisplay as
> a string. Then, in the page that is referring to the user control, I
> need to programmatically set the value of this string. In the HTML we
> declare the control as such:
>
>
>
> <%@ Page CodeBehind="default.aspx.vb" Language="vb"
> AutoEventWireup="false" Inherits="intellisoft._default" %>
>
>
>
> And then later:
>
>
>
> <uc1:navigation id="Navigation1" runat="server" />
>
>
>
> Although it does work to do this:
>
>
>
> <uc1:navigation id="Navigation1" ImageToDisplay="valueHere"
> runat="server" />
>
>
>
> I need to set the value programmatically. This in the code-behind
>
>
>
> Navigation1.ImageToDisplay = "valueHere"
>
>
>
> returns this error:
>
>
>
> 'ImageToDisplay' is not a member of 'System.Web.UI.UserControl'.
>
>
>
> As far as I can tell, I'm doing this exactly as the example
> in the book.
> What else do I need to do?
>
>
>
> Thanks,
>
>
>
> Casey
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
More information about the thelist
mailing list