Roooss
Roooss

Reputation: 634

Checkbox list Custom Kentico CMS Form user control

I have used the following two sources to try and achieve what I need:

http://devnet.kentico.com/Forums.aspx?forumid=62&threadid=28842 & http://devnet.kentico.com/docs/devguide/index.html?developing_form_controls.htm

I am trying to populate the list with a collection of values I draw from a Db table. I then want the selected values to be stored by Kentico for later use via the API.

The page_load event ensures that the Checkbox list contains items. I think where I start getting confused is how I need to override Value and IsValid to created this comma separated list of selected values to store in Kentico.

I have been able to build it and add the control in Kentico, I am also confused and unable to find much information on the meaning and context of the control scope fields and also the properties on the next tab.

I followed what was described in the documentation and added the control to a doc type's form. when I go to edit data I just get a message saying there was an error loading the control and I get no further info, I also tried debugging Kentico to run through it step by step and no luck in tracking my problems....

My question is essentially, I Know I am doing something wrong so how do I set up a Checkbox list user control in Kentico? can anybody provide some demo code dealing with this or point me in the right direction?

EDIT: Hi Again,

So I decided to go back to basics and see if I could create ANY form control... http://devnet.kentico.com/docs/devguide/index.html?developing_form_controls.htm

I followed the above guide to the letter. However, I am seeing the same error appear on the Doc type form. where it is failing to load the Type of the control.... I can provide the associated event log as well....

Source: FormEngine

EventCode: LOADFORMCONTROL

UserName: administrator

IPAddress: ::1

EventDescription: Message: Could not load type 'CMSApp.CMSFormControls.TestControl'. 
Stack Trace: 
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.Parse()
   at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
   at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
   at CMS.FormControls.EditingFormControl.InitializeControl(FormUserControlInfo ci, String controlCodeName, FormFieldInfo ffi, String defaultValue, Object value)
   at CMS.FormControls.EditingFormControl.CreateControl(FormFieldInfo ffi)

Could not load type 'CMSApp.CMSFormControls.TestControl'.
   at System.Web.UI.TemplateParser.ProcessException(Exception ex)
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)

Could not load type 'CMSApp.CMSFormControls.TestControl'.
   at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
   at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
   at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)

This is incredibly frustrating as there really isn't any more information out there regarding the creation of custom form controls and the errors I see a far less than informative imo.

Upvotes: 0

Views: 1677

Answers (1)

mivra
mivra

Reputation: 1400

Firstly, you should see the details about the error in the event log in Site manager.

Secondly, if you want to have simple checkbox list, why don't you use integrated Multiple choice form control. You can fill it with a query if you select it in the field setting.

Upvotes: 1

Related Questions