Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have this code to insert forms in pages. What I also need is the name of the form. How would I access this and place it in <h2>Form Name</h2>
<% var formId = umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("form"); if(formId != null){if(!string.IsNullOrEmpty(formId.Value)){ %> <div class="block-content"> <div class="heading"> <h2>Form Name</h2> </div><umbraco:Macro FormGuid="[#form]" Alias="umbracoContour.RazorRenderForm" runat="server"></umbraco:Macro> </div><% } } %>
@inherits umbraco.MacroEngines.DynamicNodeContext
@using Umbraco.Forms.Core
@using Umbraco.Forms.Data.Storage
@{
FormStorage fs = new FormStorage();
String formId = Parameter.FormGuid;
Form f = fs.GetForm(new Guid(formId));
fs.Dispose();
<h2>@f.Name</h2>
}
Comment author was deleted
Yup, thanks for sharing the solution :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Accessing the name of a form in a masterpage
I have this code to insert forms in pages. What I also need is the name of the form. How would I access this and place it in <h2>Form Name</h2>
@inherits umbraco.MacroEngines.DynamicNodeContext
@using Umbraco.Forms.Core
@using Umbraco.Forms.Data.Storage
@{
FormStorage fs = new FormStorage();
String formId = Parameter.FormGuid;
Form f = fs.GetForm(new Guid(formId));
fs.Dispose();
<h2>@f.Name</h2>
}
Comment author was deleted
Yup, thanks for sharing the solution :)
is working on a reply...