I know I can generate a guid through Guid.NewGuid(), but this changes at every reload. I need a solution, where I get a persistent Id for the specific instance of the partial. Is that possible?
Are you passing any parameters to the macro, could one of these be used?
What calls the macro - if you are in a loop why not iterate an ID and pass it as a macro parameter?
Your code suggests a gallery of some sort - which I presume is related to images? can you se the media id from umbraco? or is it a higher level than this?
Tell us some more about your structure and how things are called.
Say I have a landing page, where I want several call to action points (a simple form with an email input).
If I create a macro for the call to action point and use it to post to the page itself, the posting functionality will be run for every call to action point.
If I add that macro ie. in 3 different places on the page, and the user submits one of them. They all will catch that the form was submitted and run the DoSomething function.
What I would like to do is this to add a hidden input type with an id of the single instance of the macro, to use in the if part. Like this:
Render unique id for Macro Partials
Is it possible to generate a unique id per instance of ie. a macro partial?
Say I want to use a macro for generating a list of thumbnails. I want to be able to target these (and only these) thumbnails in a javascript.
Like the following
I know I can generate a guid through Guid.NewGuid(), but this changes at every reload. I need a solution, where I get a persistent Id for the specific instance of the partial. Is that possible?
Are you passing any parameters to the macro, could one of these be used?
What calls the macro - if you are in a loop why not iterate an ID and pass it as a macro parameter?
Your code suggests a gallery of some sort - which I presume is related to images? can you se the media id from umbraco? or is it a higher level than this?
Tell us some more about your structure and how things are called.
I have another use case for this problem.
Say I have a landing page, where I want several call to action points (a simple form with an email input).
If I create a macro for the call to action point and use it to post to the page itself, the posting functionality will be run for every call to action point.
Think of code like this inside the macro
If I add that macro ie. in 3 different places on the page, and the user submits one of them. They all will catch that the form was submitted and run the DoSomething function.
What I would like to do is this to add a hidden input type with an id of the single instance of the macro, to use in the if part. Like this:
Do you get, what I mean?
is working on a reply...