Click here to Skip to main content
11,575,798 members (55,983 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC Razor
Hi All ,

I want to create List View control as we can see here :

http://www.codeproject.com/search.aspx?q=*[^]

or In this site

http://www.espncricinfo.com/ci/content/story/news.html[^]

In MVC- 4 Razor technology.

Please help me.

Thanks,

Kapil
Posted 11-Apr-13 5:16am
Comments
Sandeep Mewara at 11-Apr-13 12:50pm
   
Tried anything so far?
kapilonkar at 12-Apr-13 2:44am
   
Hi Sandeep ,

Thanks for reply

No I am bit New to mvc , I have searched for using ListView in MVC but yet haven't got code snippet matching to my requirement using MVC razor.
please help me if you have an idea of how to do it.
Thanks anyways :)
Member 9802658 at 9-May-13 7:07am
   
my simple solution to paging in mvc4


regards
susmita

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

@model IEnumerable

@{
ViewBag.Title = "Index2";
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.maxPage = (ViewBag.recordsCount % OrganizationManagement.Common.Constants.rowsPerPage == 0) ? (ViewBag.recordsCount / OrganizationManagement.Common.Constants.rowsPerPage) : ((ViewBag.recordsCount / OrganizationManagement.Common.Constants.rowsPerPage) + 1);

}
@*jquery.jqpagination.min
<script src="~/Scripts/jquery.jqpagination.min.js"></script>
<link href="~/Content/jqpagination.css" rel="stylesheet" />

<script type="text/javascript">
$(document).ready(function () {

$('.pagination').jqPagination({
link_string: '~/Index2/?page={page_number}',
max_page: @ViewBag.maxPage,
paged: function (page) {
$.ajax({
url: '@Url.Action("/Index2")',
type: "GET",
data: {currentPage:page},
success: function (result) {
var $response = $(result);

//Query the jQuery object for the values
var tableValue = $response.find('#StatusIndex').html();
$('#StatusIndex').html(tableValue);
}

});
}
});

});


</script>*@


Index2


@Html.ActionLink("Create New", "Create")

@using (Html.BeginForm("Index2", "Employee"))
{






@Html.Label("Employee")
@Html.TextBox("Employee")





<input type="submit" value="Search" />

}








@foreach (var item in Model) {
}






@Html.DisplayNameFor(model => model.EmployeeName)

@Html.DisplayNameFor(model => model.LocationName)

@Html.DisplayNameFor(model => model.DepartmentName)

@Html.DisplayNameFor(model => model.DOJ)
@Html.DisplayFor(modelItem => item.EmployeeName)
@Html.DisplayFor(modelItem => item.LocationName)
@Html.DisplayFor(modelItem => item.DepartmentName)
@Html.DisplayFor(modelItem => item.DOJ)
@Html.ActionLink("Edit", "Create", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })


  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 390
1 Dave Kreskowiak 204
2 F-ES Sitecore 135
3 OriginalGriff 125
4 Abhinav S 98
0 OriginalGriff 705
1 Sergey Alexandrovich Kryukov 600
2 Abhinav S 438
3 F-ES Sitecore 400
4 Suvendu Shekhar Giri 365


Advertise | Privacy | Mobile
Web04 | 2.8.150624.2 | Last Updated 9 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100