Creating custom module following products sample
I have hard time to build custom module following the sample example of products module, and I have been looking for solution by reading the forum and blogs but could not find very good solution, it looks like I am not alone for this problem. I have a few questions and I will base them on the products module since it is the model people wants to follow.
1. How does the data mapping works in the backend module? e.g. the price field in the main section(prodcutsDefinitions.cs), a TextFieldDefinitionElement is created with DataFieldName set to "Price", how is this used to map the content of the text field to dataprovider and eventually saved in sitefinity database? I can set the breakpoint in ProductItem.cs and see the value has been set in productItem's Price property but could not get any call stack information. Could you explain the code flow and how the content from definition fields been saved?
2. I was trying to add a image field to the module. I add an Image member variable to ProductItem class the same way as "Price" but with the type of "Image", and add a imageFieldElement to show/load image, but it gives me the following error:
[MetadataException: No database type mapping found for field 'image': CLR type 'Telerik.Sitefinity.Libraries.Model.Image' or column type '' unmapped. ]
OpenAccessRuntime.Relational.metadata.RelationalMappingResolver.resolveMapping(RelationalJavaTypeMapping fieldMapping, String fieldName, Class javaType, Boolean complain) +437
OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createColumn(DataObjectsExtension[] nested, String fieldName, Class javaType, String oType, Boolean secondaryTable) +49
OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createJdbcSimpleField(FieldMetaData fmd) +173
OpenAccessRuntime.Relational.RelationalMetaDataBuilder.createJdbcField(FieldMetaData fmd, Boolean quietParam) +69
[MetadataException: The metadata for field 'image' of class 'Products.Model.ProductItem' cannot be initialized: No database type mapping found for field 'image': CLR type 'Telerik.Sitefinity.Libraries.Model.Image' or column type '' unmapped. ]
DynamicModule.ns.Wrapped_OpenAccessProvider_3ab5f363aef442af99a7bf174fe5454f.GetSecurityRoot() +162
Telerik.Sitefinity.Data.ManagerBase`1.GetSecurityRoot() +30
Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.Master.MasterGridView.GetSecurityRoot() +33
Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.Master.MasterGridView.OnInit(EventArgs e) +369
System.Web.UI.Control.InitRecursive(Control namingContainer) +140
System.Web.UI.Control.AddedControl(Control control, Int32 index) +197
System.Web.UI.ControlCollection.Add(Control child) +79
Telerik.Sitefinity.Web.UI.ContentUI.ContentView.LoadView(String viewName) +301
Telerik.Sitefinity.Web.UI.ContentUI.ContentView.CreateChildControls() +57
System.Web.UI.Control.EnsureChildControls() +102
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
What should I do to implement this? Some sample code would be appreciated.
3. How to create more complex UI for backend view? Sitefinity provides some nice out of box fields we can use, but most of time, we need more complex UI, what should we do? How does the data binding work in this situation assume we need to create a user control (.ascx) for the complex UI? Exact steps with explanation would be good.
Hello Qian,
It seems that we are already discussing your issues in ticket 431647, so i guess we can close this one.
All the best,
Nikolay Datchev
the Telerik team
Sure. I marked it as "answered"
I hate it when you guys do this - I finally find a forum post that is asking the questions I need answered... and you all take it private to the ticket. So now I am still not finding any answers.
Hi Don,
Ok, could you tell us what the problem you have is so we can try to help ?
Regards,
Ivan Dimitrov
the Telerik team
Thanks, but I am in contact with Steve Miller out of San Diego and it looks like 4.2 will be awesome!
Just for the sake of completeness:
The bottom-line of the discussion in the aforementioned ticket 431647 is that the "Product Catalog Module" SDK sample now features a custom "ProductImage" field, installed in the ProductsModule.InstallCustomTaxonomies method (I know, it should have been renamed to InstallCustomFields :) ).
All the best,
R. Atanasov
the Telerik team