Copied to clipboard

Flag this post as spam?

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


  • Albert 27 posts 49 karma points
    Nov 28, 2012 @ 16:41
    Albert
    0

    How to get dropdownlist item after being saved - Custom macro parameter type

    Hi, I'm trying to create a custom macro parameter type. I followed the post

    http://www.richardsoeteman.net/2010/01/04/CreateACustomMacroParameterType.aspx

    I have a node with a macro that has the "save cookie" parameter.

    After select the second option and save it, it saved correctly, however, the next time i access to the node, appears the first option in the dropdownlist.

    Does anyone know how to get the saved value?

     

    Thanks

  • Mike Chambers 636 posts 1253 karma points c-trib
    Jan 28, 2013 @ 16:30
    Mike Chambers
    1

    think I found a solution...

    public class SOMENEWMACROPARAM: DropDownList, IMacroGuiRendering
        {
            string _value = "";
    
            protected override void OnLoad(EventArgs e)
            {
    
                base.OnLoad(e);
    // your custom dropdown list population here...
                        try
                        {//set the previous value
                            this.Items.FindByValue(_value.ToString()).Selected = true;
                        }
                        catch { }
    
                    catch { }
                }
            }
    
            #region IMacroGuiRendering Members
    
            public bool ShowCaption
            {
                get { return true; }
            }
    
            public string Value
            {
                get
                {
                    return this.SelectedValue;
                }
                set
                {
                    this._value = value;
                }
            }
    
            #endregion

    Seems to be working for me... :-)

  • Francisco 21 posts 72 karma points
    Jun 05, 2013 @ 23:48
    Francisco
    0

    Thanks for the solution!

Please Sign in or register to post replies

Write your reply to:

Draft