Error in Umbraco usercontrol wrapper

I had created a custom data type in umbraco using Umbraco usercontrol wrapper but when i run it in umbraco node it gives me an error

 At /umbraco/editContent.aspx?id=2969 (Referred by: http://aksp:201/umbraco/umbraco.aspx): System.InvalidCastException: Unable to cast object of type 'ASP.usercontrols_shopdata_ascx' to type 'umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor'.     at umbraco.editorControls.userControlGrapper.usercontrolDataEditor.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.AddedControl(Control control, Int32 index)     at umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption)     at umbraco.controls.ContentControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at umbraco.controls.ContentControl.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.AddedControl(Control control, Int32 index)     at umbraco.cms.presentation.editContent.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I have no idea what went wrong?

Answer

This is a Cast that is not valid, it is trying to cast your custom shopdata usercontrol to the IUsercontrolDataEditor which isn’t valid.

Make sure your control implements the umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor interface

Here and here are nice guide on how to create a custom datatype with the UmbracoUsercontrol wrapper.