Learner
Learner

Reputation: 45

How to count total number of results return by list and display

I am using MVC 4.
I binding result in grid based on my search criteria in web grid. and i am showing 10 records per page.
the question is.
How can i show the total count of records below the grid.
i tried counting the result list in control and show it in view.
if i use

 @Html.TextBoxFor(m => m.NumberOfRows) 

it returns result in the text box but if i use label means if shows property name instead of total count.

 @Html.LabelFor(m => m.NumberOfRows) 

Why label show property name. How can i show the total count. or is it possible to show the total count in web grid itself? please help.

Upvotes: 0

Views: 1644

Answers (1)

Kartikeya Khosla
Kartikeya Khosla

Reputation: 18883

LabelFor() in MVC is used to display model property names,so instead using LabelFor(),if you are binding value to NumberOfRows from controller action then

Instead of

@Html.LabelFor(m => m.NumberOfRows)

Try

@Model.NumberOfRows

Upvotes: 1

Related Questions