Copied to clipboard

Flag this post as spam?

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


  • Paul de Quant 394 posts 1477 karma points
    Jul 24, 2017 @ 15:55
    Paul de Quant
    0

    How to get a unique Macro Id

    Hello,

    I've built a bootstrap tab macro, which all works fine when there's only one instance on the page. I want to allow more than one and I was hoping I could use Macro Id as my unique identifier - however this doesn't seem to be what I think it is.

    Does anyone know if there is an Id that is unique to the individual macro instance on a page?

    Thanks

    Paul

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 24, 2017 @ 16:02
    Alex Skrypnyk
    0

    Hi Paul

    You can use MacroId, if you are inheriting from "PartialViewMacroPage" it's easy:

    Model.MacroId
    

    Thanks,

    Alex

  • Paul de Quant 394 posts 1477 karma points
    Jul 24, 2017 @ 16:04
    Paul de Quant
    0

    Hi Alex,

    That's what I tried, but the Macro ID seems to be the Id of the Macro itself and not the instance.

    Thanks

    Paul

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 24, 2017 @ 16:16
    Alex Skrypnyk
    101

    Maybe you can pass Guid each time you call the macro via macro params, and use it like the unique id of macro entry?

  • Paul de Quant 394 posts 1477 karma points
    Jul 24, 2017 @ 16:26
    Paul de Quant
    1

    Hi Alex,

    Thanks - I've got it working now - I ended up calling:-

    Guid macroId = Guid.NewGuid();

    At the top of my view, which allowed me to use it as my unique identifier.

    Thanks for the idea.

    Paul

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 24, 2017 @ 16:27
    Alex Skrypnyk
    0

    You are welcome, Paul.

    Have a nice evening!

  • 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