Can I get the DataSource set and Parameters for a sublayout via code-behind?
using Sitecore;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Data.Query;
using Sitecore.Configuration;
using Sitecore.Express;
using Sitecore.Layouts;
using Sitecore.SecurityModel;
using Sitecore.Sites;
….
protected void GetDataSource_Click(object sender, EventArgs e)
{
Database db = Sitecore.Context.Database;
Item item = db.Items["/sitecore/content/home/Node1"];
string rend = item.Fields["__renderings"].Value;
LayoutDefinition layout = LayoutDefinition.Parse(rend);
DeviceItem dev = Sitecore.Context.Device;
DeviceDefinition device = layout.GetDevice(dev.ID.ToString());
Item mySublayout = db.Items["/sitecore/layout/Sublayouts/MySublayout"];
RenderingDefinition rendering = device.GetRendering(mySublayout.ID.ToString());
Response.Write("Parameters: " + rendering.Parameters);
Response.Write("<br/>");
Response.Write("DataSource: " + rendering.Datasource);
}