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 109 posts 296 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?

  • Tim Geyssens 6419 posts 15036 karma points MVP 2x c-trib
    Jan 24, 2012 @ 14:57
    Tim Geyssens
    0

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

  • Rasmus Lynggaard 109 posts 296 karma points
    Jan 24, 2012 @ 14:58
    Rasmus Lynggaard
    0

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

  • Tim Geyssens 6419 posts 15036 karma points MVP 2x c-trib
    Jan 24, 2012 @ 14:59
    Tim Geyssens
    1

    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 109 posts 296 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