2010-07-23 4 views
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 UserControl을

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); 



    } 

답변

0

내가 잘못 될 수 있지만이 같은 매개 변수를 전달하는 시도 할 수 있습니다 또한

<%= Ajax.ActionLink("a", "GetUser", new { Alp = "a" }, new AjaxOptions { UpdateTargetId = "divGrid", HttpMethod = "Post" })%> 

을했다 컨트롤러 메소드가 성공했는지 확인했다. 디버그 모드에서? 매개 변수가 제대로 전달 되었습니까? (다른 쪽에서도 괜찮은 것처럼 보입니까?)

+0

예 매개 변수가 올바르게 전달되고 컨트롤러가 디버그 모드에서 적중 함 – maztt

관련 문제