Unleash the Potential of Power Platform With a Center of Excellence
Business innovation often comes from within. Discover how to empower innovation from non-traditional developers with the Microsoft Power Platform.
This is will be a quick blog about a detail involving Sitecore which I find myself using more and more. Often in Sitecore, we have a component which can be added multiple times to a page but we need the means to identify a specific instance of that component in code to perform some activity on that specific instance.
One way to unique identify a component is using the component’s rendering id. When a specific instance of a component is added to a Sitecore page, Sitecore will assign that specific component instance a Guid to unique identify that instance.
This Guid is accessible through code. In the MVC view I was developing for this component, I referenced the Guid using this piece of code.
For instance, I used this code to set the “id” attribute of the component’s section HTML tag within the MVC view code. I was then able to pass this unique “id” into the jQuery code which was able to now identify that specific component instance and only perform that front-end action on that specific one.