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?
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
Hi Paul
You can use MacroId, if you are inheriting from "PartialViewMacroPage" it's easy:
Thanks,
Alex
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
Maybe you can pass Guid each time you call the macro via macro params, and use it like the unique id of macro entry?
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
You are welcome, Paul.
Have a nice evening!
is working on a reply...