I studied the various examples and demos to create a custom datatype using AbstractDataEditor. All the examples are embedding a usercontrol in the editor that inherits from System.Web.UI.WebControls.Panel. With this the developer must more or less hardcode the controls/html that is rendered by the control in the OnInit method of the control. In ASP.NET however web user controls normally inherit from System.Web.UI.UserControl and have a code-behind file and an ascx file. The ascx file allows you to design the visual appearance of the control using a combination of asp and html tags and attributes. The code behind will typically be restricted to binding and control (at least in my view of trying to seperate model/control from presentation).
I tried to use the latter concept (a 'pure' web usercontrol with ascx file) and embed it in my data editor but this doesn't seem to work. Although the Page_Load method gets called the ascx file apparently doesn't get parsed and its controls don't get inserted in the editor view.
Am I missing something or is this intended to be so?
You create datatypes using AbstractDataEditor its a bit more involved but more flexiblity. The other way is using UserControlIWrapper which is easier and until 461 did not give you the option of settings. Also take a look at umbraco tv vids about creating datatypes.
Thanks Ismail for the prompt reply. I knew about the usercontrol grapper method but didn't want to use it because it doesn't allow configurable datatypes. Luckily this changes in 4.6. Leaves one of course with the dilemma whether it is safe today to switch to 4.6.
Custom DataType using an ascx UserControl
I studied the various examples and demos to create a custom datatype using AbstractDataEditor. All the examples are embedding a usercontrol in the editor that inherits from System.Web.UI.WebControls.Panel. With this the developer must more or less hardcode the controls/html that is rendered by the control in the OnInit method of the control. In ASP.NET however web user controls normally inherit from System.Web.UI.UserControl and have a code-behind file and an ascx file. The ascx file allows you to design the visual appearance of the control using a combination of asp and html tags and attributes. The code behind will typically be restricted to binding and control (at least in my view of trying to seperate model/control from presentation).
I tried to use the latter concept (a 'pure' web usercontrol with ascx file) and embed it in my data editor but this doesn't seem to work. Although the Page_Load method gets called the ascx file apparently doesn't get parsed and its controls don't get inserted in the editor view.
Am I missing something or is this intended to be so?
Any help appreciated.
Jos,
Read
http://www.nibble.be/?p=24
In juno Umbraco 461 its slightly different see http://www.nibble.be/?p=97
You create datatypes using AbstractDataEditor its a bit more involved but more flexiblity. The other way is using UserControlIWrapper which is easier and until 461 did not give you the option of settings. Also take a look at umbraco tv vids about creating datatypes.
Regards
Ismail
Thanks Ismail for the prompt reply. I knew about the usercontrol grapper method but didn't want to use it because it doesn't allow configurable datatypes.
Luckily this changes in 4.6. Leaves one of course with the dilemma whether it is safe today to switch to 4.6.
is working on a reply...