Copied to clipboard

Flag this post as spam?

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


  • Stefan Ekman 18 posts 37 karma points
    Oct 03, 2011 @ 12:49
    Stefan Ekman
    0

    Retrieving custom Macro Parameter

    Hi Guys,

    I have made my custom macro parameter type which gives me an DropDown populated from a DB when adding the macro to a page but I'm struggling reading the value in code behind.

    This code here:

            protected void Page_Load(object sender, EventArgs e)

            {

                if (!IsPostBack)

                {

                    Node myNode = Node.GetCurrent();

                    foreach (var item in myNode.PropertiesAsList)

                    {

                        registerPopup.InnerHtml += item.Alias + " - " + item.Value + "<br />";

                    }

                }

            }

     

    Generate following output:

    bodyText - 
    contentPanels - 
    title - 
    description - 
    keywords - 
    umbracoNaviHide - 0

    Should not my custom parameter be in there?

  • Stefan Ekman 18 posts 37 karma points
    Oct 03, 2011 @ 12:54
    Stefan Ekman
    0

    If I view page source I see this:

    <?UMBRACO_MACRO eventselector="6"
     

    macroAlias="ShowEvent" />

     

    And its the value of eventselector I'm looking for!

  • Stefan Ekman 18 posts 37 karma points
    Oct 03, 2011 @ 16:51
    Stefan Ekman
    0

    Hi again,

    I found the video http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/macro-parameters.aspx that explained it all, I wish there was some better index showing an overview of the videos available as I struggle to find the ones I do look for.

    Anyway I was using this property:

           public int eventid

            {

     

                get { return event_id; }

     

                set { event_id = value; }

     

            }

     

    If I changed it to        

    public string eventid { get; set; }

    it all worked much better!

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies