tags:

views:

30

answers:

1

i want to implement the alphabetical navigation like A B C D and so on ,when the user press any alphabet ,it will populate the table with the record based on the alphabet.Can someone help to correctly implement that . here is my start. Basically i am having problem in populating the records. on clicking the alphabet it doesn't do anything.

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>

Get User Action

 public ActionResult GetUser(string Alp)
    {
        var list = _db.Users.Where(m=>m.vcr_UserName.StartsWith(Alp));

            return PartialView("ManageUs", list);



    }
A: 

I might be wrong, but try to pass the parameter like this:

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

Also, did you checked if the controller method get hit in debug mode? Are the parameter passed correctly (does it looks okay on the other side)?

ŁukaszW.pl
yes the parameter is passing correctly and the controller get hit on the debug mode
mazhar kaunain baig