Hi All, Welcome back, in this post we will see about the difference between context item and data source item in sitecore.
Context Item vs Data Source Item
Context Item:
API
var contextItem=RenderingContext.Current.ContextItem
- Context Item is the item that is mapped to the current URL.
- Item holds the presentation details to render the page.
DataSource Item:
Data source Item can be set in the component definition item .
API
var contextItem=RenderingContext.Current.Rendering.Item
Advantages of using data source item:
- Easily we can change the item
- Fallback item(if item is not found) is the context item
- Components become more reusable.
that's all, please share this with your friends, comment me if any wrong in this post. Happy Coding :)
No comments:
Post a Comment