Click here to Skip to main content
12,251,445 members (60,724 online)
Rate this:
 
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 11-Apr-13 12:50pm
   
Tried anything so far?
kapilonkar 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 9 May 2013
Copyright © CodeProject, 1999-2016
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