0
我想实现类似ABCD等字母顺序的导航,当用户按任何字母表时,它将填充基于字母表的记录表。可以帮助某人正确地执行那个。这是我的开始。 基本上我在填充记录有问题。点击字母它什么也不做。asp.net mvc alpahetical naviagation填充记录问题
Manage User View
<%= Ajax.ActionLink("a", "GetUser", new RouteValueDictionary(new { Alp = "a" }), new AjaxOptions { UpdateTargetId = "divGrid", HttpMethod = "Post" })%>
<%= Ajax.ActionLink("b", "GetUser", new RouteValueDictionary(new { Alp = "b" }), new AjaxOptions { UpdateTargetId = "divGrid", HttpMethod = "Post" })%>
<%= Ajax.ActionLink("c", "GetUser", new RouteValueDictionary(new { Alp = "c" }), new AjaxOptions { UpdateTargetId = "divGrid", HttpMethod = "Post" })%>
<div id="divGrid">
<% Html.RenderPartial("ManageUs", this.Model); %>
</div>
ManageUs用户控件
Manage User</h2>
<% Response.Write("Page "); Response.Write("<b>" + ViewData.Model.PageNumber + "</b>"); Response.Write(" Of "); Response.Write("<b>" + ViewData.Model.PageCount + "</b>"); %>
<table>
<thead>
<tr>
<th>
User Name
</th>
<th>
Email Address
</th>
<th>
Phone
</th>
<th>
Group
</th>
<th>
Organization
</th>
<th>
Actions
</th>
</tr>
</thead>
<tbody>
<% foreach (var item in Model)
{ %>
<tr id="row-<%: item.int_UserId %>">
<td>
<%= Html.Encode(item.vcr_UserName) %>
</td>
<td>
<%= Html.Encode(item.vcr_EmailAddress) %>
</td>
<td>
<%= Html.Encode(item.vcr_Phone) %>
</td>
<td>
<%= Html.GroupUserWise(item.int_UserId) %>
</td>
<td>
<%= Html.OrganizationUsersWise(item.int_UserId) %>
</td>
<td>
<a href=' <%= Url.Action("Edit", new { id=item.int_UserId }) %>'>
<img src="../../Content/images/edit.png" alt="Edit" /></a> <a href=' <%= Url.Action("Details", new { id=item.int_UserId }) %>'>
<img src="../../Content/images/add.png" alt="Details" /></a>
<%-- <%= Ajax.ActionLink("Delete", "Delete", new { id = item.int_UserId }, new AjaxOptions { UpdateTargetId = "table", HttpMethod = "Post", Confirm = "Delete User with User ID:" + item.int_UserId + " UserName Name:" + item.vcr_UserName, OnBegin = "hide" })%> |--%>
<%= Ajax.AjaxImageActionLink("../../Content/images/delete.png", "Delete", "DeleteRecord", new { id = item.int_UserId }, new AjaxOptions { UpdateTargetId = "msgdiv",LoadingElementId = "divLoading" })%>
<%= Ajax.AjaxImageActionLink("../../Content/images/add.png", "Change Password", "ChangePasswos", new { id = item.int_UserId }, new AjaxOptions { UpdateTargetId = "msgdiv" })%>
</td>
</ tr>
<% } %>
</tbody>
</table>
<div class="pager">
<%= Ajax.Pager(new AjaxOptions { UpdateTargetId = "divGrid", LoadingElementId = "divLoading" },
ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { controller = "User", action = "ManageUser" })%>
</div>
获取用户操作
public ActionResult GetUser(string Alp)
{
var list = _db.Users.Where(m=>m.vcr_UserName.StartsWith(Alp));
return PartialView("ManageUs", list);
}
yes参数传递正确,控制器遇到调试模式 – maztt 2010-07-27 05:25:50