Copied to clipboard

Flag this post as spam?

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


  • Johan 188 posts 380 karma points
    Apr 26, 2009 @ 12:21
    Johan
    0

    dropdown as macro parameter

    Is it possible to have a dropdown list as a macroparameter? I only want the user to have four options and if i let him type in the option himself it is bound to fail. Especially since you can't write a instruction text next to the parameter option.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 26, 2009 @ 17:26
    Dirk De Grave
    1

    Hi Johan,

    Does not exists ootb, but it could be made quite easily. Just derive from the asp.net dropdown list, implement a single interface IMacroGuiRendering and you're done.

    [code]public interface IMacroGuiRendering
    {
    ///


    /// Gets or sets the value.
    ///

    ///
    string Value {set; get;}
    ///
    /// Gets a value indicating whether a caption is shown
    ///

    ///
    bool ShowCaption {get;}
    }[/code]

    Hope this helps.

    Regards,
    /Dirk

  • Johan 188 posts 380 karma points
    Apr 27, 2009 @ 22:26
    Johan
    0

    Thanks, i don't really understand how and where to create this class though. Is there some docs on how to extend a macro like this? Is it possible to include the mod in a package?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 27, 2009 @ 23:01
    Dirk De Grave
    1

    Hi,

    It doesn't matter where this class lives, just need to implement this interface. Register the assembly and class name in the database (cmsMacroPropertyType) and you're ready to go.

    If you need a help on this, just shout...

    Docs on creating a new macro property type? Haven't seen one myself....

    Mods in a package? Hmm, sure, I think it can be done using a custom package action that does the db change to register the macro property type.

    Cheers,
    /Dirk

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Apr 28, 2009 @ 10:03
    Ismail Mayat
    0

    Johan,

    See http://umbracoext.codeplex.com/Thread/View.aspx?ThreadId=22521 I did something ages ago which provided the ability to add extra functionality to macro properties, its version 3. My old blog is down so the instructions link wont work ill see if i can find the instructions. Download the macrorenderings source update the dll references to v4 should compile. Have a look through the code there is an example implementation of creating drop down with source data coming from csv or xml file.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Apr 28, 2009 @ 10:12
    Ismail Mayat
    0

    JOhan,

    Could'nt find instuctions but see this post half way down there are some screen shots, this post initially got me going on creating the macrorenderings dll which is on codeplex.

    Regards

    Ismial

  • Johan 188 posts 380 karma points
    Apr 29, 2009 @ 14:15
    Johan
    0

    Ismail,
    Google had your old post cashed :P
    Cashed post
    I'm not sure i can pull this of so i think i will put this little project on hold for now.

  • Yoann 8 posts 20 karma points
    Jul 10, 2009 @ 12:51
    Yoann
    0

    Hello,

    I am in Umbraco 4.0.2.1, .net 3.5

    I try to create a new dropdownlist macro parameter and when I insert the macro in my editor, my parameter is not visible.

    This is my class:

    public class MemberGroupList : DropDownList, IMacroGuiRendering
        {
            string _value;
            public string Value
            {
                get { return this.SelectedValue; }
                set { _value = value; }
            }

            public bool ShowCaption
            {
                get { return true; }
            }

            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
               
                this.DataSource = MemberGroup.GetAll.ToList();
                this.DataTextField = "Text";
                this.DataValueField = "Id";
                this.DataBind();
           
            }
        }

     

    The parameter is visible in the drop down list of type in the macro parameters tab but nothing in the edit panel when I insert the macro.

    Any solutions about my problem please ?

    Thanks in advance

  • Martijn Maris 37 posts 235 karma points MVP
    Jul 29, 2009 @ 18:53
    Martijn Maris
    0

    One thing to mention is that you should use the same name for the namespace as for the assembly. I tried with different names but without success. The parameter showed up in the dropdownlist for selecting one, but it didn't render whitin TinyMCE. After changing the name of the namespace to the name of the assembly everthink worked fine.

Please Sign in or register to post replies

Write your reply to:

Draft