Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2013, 03:48 PM
Registered User
 
Join Date: May 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default MVC View - The result of a query cannot be enumerated more than once.

Hi,

I'm a newbie to MVC and am struggling to re-write a site that I previously wrote in webforms.

I have an existing stored procedure which when it gets called, populates a table with the weeks' football fixtures.

The user would then make their predictions for each fixture from drop downs and I then hope to insert all the predictions together using model binding.

I've shown the relevant code below from my view which is currently causing me a headache:

@model IEnumerable<PPLMVCNewOne.Models.sp_getMakeYourPred ictions_Result>


@for (int i = 0; i < Model.Count(); i++)
{
<tr>
<td>
@Html.DisplayFor(m => m.ElementAt(i).Home_Team)



What I'm trying to do is add an index so I can model bind within the action result.

It's at the html helper line that I'm getting the following error:

The result of a query cannot be enumerated more than once.

Can anyone please give me a pointer in the right direction?

Thanks in advance,

Dave





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the view of result ramankumar_04 SQL Language 2 January 27th, 2011 03:12 PM
Errors while upgrade theBeerHouse mvc project form asp.net mvc 1.0 to 2.0 vanbach1304 BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 0 April 20th, 2010 06:43 AM
TheBeerHouse MVC preview ASP.NET MVC Website Programming Problem Design Solution jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 July 18th, 2009 09:16 AM
Query Result mateenmohd SQL Server 2000 0 November 1st, 2003 03:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.