Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 2 = Counting and other Statistics
    text
    copied!<p>I am using MVC 2 and displaying a grid . Now at the end of this grid i want to show different statistics e.g.</p> <p>Number of Rows in Grid Number of Row where One particular column is Null Sum of Values in one Particular Column</p> <p>The code part i am using to display the grid is below</p> <pre><code> &lt;% foreach (var item in Model) {%&gt; &lt;tr&gt; &lt;td&gt; &lt;%: item.tblCourse.CourseName %&gt;&lt;/td&gt; &lt;td&gt; &lt;%: item.NeededHoursPerWeek %&gt; &lt;/td&gt; &lt;td&gt; &lt;%:item.tblCourseWantedHours.Sum(x=&gt;x.WantedHoursPerWeek)%&gt; &lt;/td&gt; &lt;td&gt; &lt;%: item.NeededHoursPerWeek - item.tblCourseWantedHours.Sum(x =&gt; x.WantedHoursPerWeek)%&gt; &lt;/td&gt; &lt;td&gt; &lt;% foreach (var i in item.tblCourseWantedHours) { %&gt; &lt;%: i.tblPerson.Surename %&gt; &lt;% } %&gt; &lt;/td&gt; &lt;td&gt; &lt;%: item.tblCourse.tblInstitute.InstituteName %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;% } %&gt; </code></pre> <p>I have simple controller</p> <p>public ActionResult Index(string semester) {</p> <pre><code> var allCoursesNeedHours = _pr.FindAllCourseNeededHoursInSemester(semester); if (allCoursesNeedHours.Count() == 0) return View("NotFound"); return View(allCoursesNeedHours); } </code></pre> <p>and a simple Query in Repository</p> <p><strong>public IQueryable FindAllCourseNeededHoursInSemester(string semester) { return from allCourses in _db.tblCourseNeededHours orderby allCourses.tblCourse.CourseName where allCourses.Semester == semester select allCourses; }</strong></p> <p>The View Code i have already shown, so can u please guide me at which place i have to make changes to get these statistics. As i am new to MVC 2 so i am confused to get the results</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload