Copied to clipboard

Flag this post as spam?

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


  • Rasmus Lynggaard 118 posts 325 karma points
    Jan 24, 2012 @ 14:48
    Rasmus Lynggaard
    0

    Contour form from codebehind (umb 4.0.2.1, Contour 1.1.9)

    I have a problem adding a contour form from codebehind in a usercontrol. I've tried two different paths with no or little success.

    The first path I went, was adding the form as a macro, like this

    var mcr = new Macro();
    mcr.Alias = "umbracoContour.RenderForm";
    mcr.MacroAttributes.Add("FormGuid", item.GetProperty("form").Value);
    div.Controls.Add(mcr);

    This doesn't give me anything - nothing renders.

    The second way I went was adding the ascx file with loadcontrol, like this:

    var ucForm =(Umbraco.Forms.UI.Usercontrols.RenderForm)LoadControl("~/usercontrols/umbracoContour/RenderForm.ascx");
    ucForm.FormGuid = item.GetProperty("form").Value;
    div.Controls.Add(ucForm);

    This webt a little better. The form was actually rendered, but if I reload the page(F5), the fields was added once again.

    On load is looks like this

     

    On reload it looks like this

    Can anybody help me out here?

  • Comment author was deleted

    Jan 24, 2012 @ 14:57

    Hey Rasmus, what version of umbraco are you running this on?

  • Rasmus Lynggaard 118 posts 325 karma points
    Jan 24, 2012 @ 14:58
    Rasmus Lynggaard
    0

    As the title says - umbraco 4.0.2.1 and contour 1.1.9 :-)

  • Comment author was deleted

    Jan 24, 2012 @ 14:59

    I would assume that the second one is correct but seems there is an issue with the caching, could you try disabling the caching int he contour config file (found in the  /umbraco/plugins/contour dir)

  • Rasmus Lynggaard 118 posts 325 karma points
    Jan 24, 2012 @ 15:01
    Rasmus Lynggaard
    0

    That did the trick. Thank you.

Please Sign in or register to post replies

Write your reply to:

Draft