I’m trying to get the sublayout item (or item id) in the codebehind. Is this possible?
Update:
I do not mean the Datasource item or the Current item, I’m talking about the Sublayout rendering definition item. This has a 1-to-1 relationship with the sublayout file.
Codebehind file:
public partial class Product_Sublayout : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Sublayout subLayout = this.Parent as Sublayout;
Item subLayoutItem = null; //How to get sublayout rendering definition item here?
}
}
This page will explain the details, but here’s the code that you need:
UPDATE:
You can probably get the rendering item itself by using the database to get it by ID: