日期:2014-05-17  浏览次数:20936 次

.net mvc 3 分页,显示数据序号自增????
分页代码
            IList<UserSexCode> uList = userSexCodeService.GetModelList("");
          //  ViewBag.Ulist = uList;
            if (String.IsNullOrEmpty(page))
            {
                page = "1";
            }

            var model = GetPageGridView(uList.Count, Convert.ToInt32(page));
            ViewBag.MyGridView = model;
            ViewBag.Ulist = uList
                .OrderByDescending(x => x.serialnumber)
               .Skip((model.CurrentPageIndex - 1) * model.PageSize)
               .Take(model.PageSize)
               .ToList();

      显示代码
@{
    Layout = "~/Views/Shared/_Blank.cshtml";
    int index = 1;
}
<link href="@Url.Content("~/Styles/bootstrap.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Styles/theme.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Styles/bootstrap-responsive.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap.js")"></script>
<script src="@Url.Content("~/Scripts/superfish.js")"></script>
<table cellspacing="0" class="table table-condensed table-striped" id="mytable">
       <thead>
        <tr>
            <th>编号</th>
            <th>代码</th>
            <th>名称</th>
            <th>简称</th>