Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Wayne 15 posts 72 karma points
    Feb 22, 2013 @ 05:47
    Wayne
    0

    Contour 3 multi control field in MVC

    Running 4.11.4 with Contour 3.0.6

    default rendering is MVC

    have removed ContourFormBuilderHttpModule from web.config

    have Contour 1x versions of custom fields - which work fine with webform templates (even with default render as MVC)

    these custom fields render multiple controls, in debug the Editor method doesnt get called when used in MVC template;

    public override System.Web.UI.WebControls.WebControl Editor
    {
      get
      {
        System.Web.UI.WebControls.Panel pnl = new System.Web.UI.WebControls.Panel();
        pnl.ID = "pnlHolder";
        pnl.CssClass = "contourlabelfield";
        string actualText = ParseTokens(TextToShow);
        pnl.Controls.Add(new System.Web.UI.LiteralControl("<p>" + umbraco.library.ReplaceLineBreaks(actualText) + "</p>"));
        return pnl;
      }
    .
    .
    .

    Have a view template for each field, but these no longer work, one renders nothing, the other fails with this exception.

    Message=No node exists with id '1410'
    Source=cms
    StackTrace:
    at umbraco.cms.businesslogic.CMSNode.setupNode()
    at umbraco.cms.businesslogic.member.Member.setupNode()
    at Umbraco.Forms.Data.StringHelper.(String , Object )
    at Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(HttpContext Context, Record record, String value)
    at Umbraco.Forms.Mvc.Models.FormViewModel.FetchRecordValues(Field field, Record record) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.Mvc\Models\FormViewModel.cs:line 185
    at Umbraco.Forms.Mvc.Models.FormViewModel.Build() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.Mvc\Models\FormViewModel.cs:line 115
    at Umbraco.Forms.Mvc.Controllers.FormRenderController.ContourForm() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.Mvc\Controllers\FormRenderController.cs:line 54
    at lambda_method(Closure , ControllerBase , Object[] )
    at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
    at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
    InnerException:

    I 'm after an example of a multicontrol field using a view template with the processing within the fieldtype dll

    or

    how to get a 1x fieldtype to work in MVC

     

    W

  • Comment author was deleted

    Feb 22, 2013 @ 09:52

    Hi,

    Yes the Editor property isn't used for the mvc part since it returns a webcontrol...

    To see how to update for mvc support take a look at the default providers sourcecode: http://our.umbraco.org/FileDownload?id=5060

  • Wayne 15 posts 72 karma points
    Feb 26, 2013 @ 02:53
    Wayne
    0

    Ok, thought that would have been the case.

    The source code mentioned does not support MVC, all the fieldTypes in the source still only have the Editor property and return a webcontrol....

    Is there an updated version for MVC ?

  • Comment author was deleted

    Feb 26, 2013 @ 10:10

    It does :) those support both webforms and mvc, for mvc you'll need a view and possible a custom ProcessValue method (take a look at the upload control)

  • Wayne 15 posts 72 karma points
    Mar 02, 2013 @ 06:41
    Wayne
    0

    Hi,

    finally had another look at this. Yes I now see that all pre-processing needs to be initiated from within the view (makes sense of course but a bit of a rewrite in my case).

    further to the actual error reported above, its actually related to the default values my custom fields use;

    I expanded the intital concept of default value parameters http://our.umbraco.org/forum/umbraco-pro/contour/15471-Default-values-parameters-from-session with a curly backet syntax.

    e,g {member.Name} and {member.email} which uses the current membership provider

    The use of '{}' around a default value on any contour fieldtype seems to be the cause - for me anyway..........

Please Sign in or register to post replies

Write your reply to:

Draft