Getting current doc ID from custom 'DataType' control?
I have set up a custom DataType by way of a UserControl that implements 'IUsercontrolDataEditor', and I am trying to retrieve the ID of the currently selected Document/Node that the usercontrol appears on.
If I'm writing a regular UserControl to be used as a Macro for the frontend I normally use...
But when used in a custom DataType it throws a NullReferenceException - Object reference not set to an instance of an object. Here is the code I'm using...
Getting current doc ID from custom 'DataType' control?
I have set up a custom DataType by way of a UserControl that implements 'IUsercontrolDataEditor', and I am trying to retrieve the ID of the currently selected Document/Node that the usercontrol appears on.
If I'm writing a regular UserControl to be used as a Macro for the frontend I normally use...
[code]Node currentPage = Node.GetCurrent();[/code]
But when used in a custom DataType it throws a NullReferenceException - Object reference not set to an instance of an object. Here is the code I'm using...
[code]public partial class ConfigureAdmins : System.Web.UI.UserControl, IUsercontrolDataEditor
{
protected void Page_Load(object sender, EventArgs e)
{
Node currentPage = Node.GetCurrent();
}
public object value
{
get { return null; }
set { }
}
}[/code]
What am I doing wrong? Cheers!
Doh! It seems I should try searching existing umbraco forum threads more. I found I can use...
[code]int nodeId = Int32.Parse(Request.QueryString["id"]);[/code]
...as the ID gets passed to the iframe as a querystring parameter.
is working on a reply...