Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Elad Lachmi 112 posts 144 karma points
    Apr 20, 2011 @ 02:12
    Elad Lachmi
    0

    Access usercontrol properties

    Hi,

    I have followed several wiki and forum posts on here trying to get this going, with no luck.

    In the ascx file code-behind class I have the following:

     

     

    public 

     

     

     

    string 

    BrokerName

    get {return ViewState["brokerName"].ToString();}

     

    set {ViewState["brokerName"] = value

    ;}

    In Umbraco I added the control property to the macro and when I add the macro, I am asked for a value. In the node itselft I have a brokerName property and so for the value of the macro property I write:

    <umbraco:Macro BrokerName="[#brokerName]" Alias="activationForm" runat="server"></umbraco:Macro>

    I can't see where I went wrong. When I load the page I get an "object reference not set to an instance of an object" error. In the call stack I see this is fired from the get method of the property.

    I'm a little lost.

    Thank you!

    -Elad

  • Elad Lachmi 112 posts 144 karma points
    Apr 20, 2011 @ 04:11
    Elad Lachmi
    0

    Ok. I figured it out myself.

    Using the viewstate does not work. I used a provate member instead and it works great.

    Ya learn something new everyday :)

Please Sign in or register to post replies

Write your reply to:

Draft