Copied to clipboard

Flag this post as spam?

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


  • Brad 14 posts 105 karma points
    Mar 27, 2018 @ 22:02
    Brad
    0

    List Umbraco Form Entries on a webpage

    I'd like to list the entries from a form on a webpage, but I'm not having any luck with the code provided in the docs. Below is my code and the error i get is : "There is already an open DataReader associated with this Command which must be closed first."

    What am I doing wrong????

    @using System;
    @using System.Collections.Generic;
    @using System.Linq;
    @using System.Web;
    @using System.Web.Mvc;
    @using Umbraco.Web.WebApi;
    @using Umbraco.Forms.Data.Storage;
    @using Umbraco.Forms.Core;
    
    @using Umbraco.Forms.Mvc.DynamicObjects
    
    <ul id="comments">
     @foreach (dynamic record in Library
               .GetApprovedRecordsFromForm("@CurrentPage.Id"))
     {
         <li>
              @record.Created.ToString("dd MMMM yyy")
              @if(string.IsNullOrEmpty(record.Website)){
                 <strong>@record.Name</strong>
              }
              else{
                 <strong>
                   <a href="@record.Website" target="_blank">@record.Name</a>
                 </strong>
              }
             <span>said</span>
            <p>@record.Comment</p>
         </li>
      }
    </ul>
    
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 03, 2018 @ 10:45
    Dennis Aaen
    0

    Hi Brad,

    Sorry to hear that you have issues with listing Umbraco Form Entries on a webpage

    Please have a look at my answer on the thread below.

    https://our.umbraco.org/forum/umbraco-forms/91395-trying-to-fetch-record-data-using-form-id

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft