Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7521365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:13:28+00:00 2026-05-30T02:13:28+00:00

I Have a little problem with WebGrid control for Asp.Net MVC3. What I want

  • 0

I Have a little problem with WebGrid control for Asp.Net MVC3. What I want is to perform a search view using ajax and webgrid; something like this:

Search Criteria ______________________________

Subject: _____

Task Type: _____

SUBMIT SEARCH


WebGrid withPaging

.

When I click the button search it call the HTTPost action by ajax and apply the search criteria; however when I try to do paging it goes to the HTTPGet action; in this way, the filter according to the search criteria doesn’t execute.

I put the grid inside a partial view; there is the code:

    @model IEnumerable<MVC3.Models.Task>
@{
    var grid = new WebGrid(null, rowsPerPage: 2, canPage: true, canSort: true, ajaxUpdateContainerId: "myGrid");
    grid.Bind(Model, rowCount: 3, autoSortAndPage: true);
    grid.Pager(mode: WebGridPagerModes.All);
    @grid.GetHtml(
    columns: grid.Columns(
            grid.Column(format: (item) => Html.ActionLink("Assign Notifications", "AssignNotifications", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Delete", "Delete", new { id = item.TaskId })),
            grid.Column("Subject"),
            grid.Column("Comment"),
            grid.Column(columnName: "Status", header: "Status", format: (item) => item.TaskStatu.Name),
            grid.Column(columnName: "StartDate", header: "Start Date", format: (item) => item.StartDate.ToString("MM/dd/yyy")),
            grid.Column(columnName: "Deadline", header: "Dead Line", format: (item) => item.Deadline.ToString("MM/dd/yyy"))
            )
    );
}

And my Index view looks like:

@model MVC3.ViewModel.TaskSearchViewModel
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Task Index</h2>
<hr />
@using (Ajax.BeginForm(new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "myGrid" }))
{
    <div id="Filters">
        <fieldset>
            <legend>Search criteria</legend>
            <br />
            <table>
                <tr>
                    <td>
                        @Html.LabelFor(x => x.Subject)
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.Subject, new { style = "width: 255px;" })
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.LabelFor(x => x.TaskTypeId)
                    </td>
                    <td>
                        @Html.DropDownListFor(x => x.TaskTypeId, Model.GetTaskTypesSelectList(), "Select", new { style = "width: 260px;" })
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.LabelFor(x => x.ResponsableId)
                    </td>
                    <td>
                        @Html.DropDownListFor(x => x.ResponsableId, Model.GetResponsablesSelectList(), "Select", new { style = "width: 260px;" })
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.LabelFor(x => x.StatusId)
                    </td>
                    <td>
                        @Html.DropDownListFor(x => x.StatusId, Model.GetStatusSelectList(), "Select", new { style = "width: 260px;" })
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
    @Html.Hidden("page")
    <input id="btnSearch" type="submit" value="Search" />
}
<br />
<div id="myGrid">
    @Html.Partial("_TaskSearchResult", Model.ResultTask)
</div>
<br />
@Html.ActionLink("Create new Task", "NewTask")

So if anyone know how to solve my problem I’ll be grateful.

Greeting
Arturo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:13:28+00:00Added an answer on May 30, 2026 at 2:13 am

    I think it’s because you’re replacing the grid each time you click the next page link. Maybe use it something like this:

    @model IEnumerable<MVC3.Models.Task>
    @{
        var grid = new WebGrid(null, rowsPerPage: 2, canPage: true, canSort: true, ajaxUpdateContainerId: "myGrid");
        grid.Bind(Model, rowCount: 3, autoSortAndPage: true);
        grid.Pager(mode: WebGridPagerModes.All);
    <div id="myGrid">
        @grid.GetHtml(
        columns: grid.Columns(
                grid.Column(format: (item) => Html.ActionLink("Assign Notifications", "AssignNotifications", new { id = item.TaskId })),
                grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.TaskId })),
                grid.Column(format: (item) => Html.ActionLink("Delete", "Delete", new { id = item.TaskId })),
                grid.Column("Subject"),
                grid.Column("Comment"),
                grid.Column(columnName: "Status", header: "Status", format: (item) => item.TaskStatu.Name),
                grid.Column(columnName: "StartDate", header: "Start Date", format: (item) => item.StartDate.ToString("MM/dd/yyy")),
                grid.Column(columnName: "Deadline", header: "Dead Line", format: (item) => item.Deadline.ToString("MM/dd/yyy"))
                )
        );
    </div>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little problem. I can't use AcceptVerb.Get on some ASP.NET MVC actions because
I have a little problem with a query. I'm selecting data using the between
I have a little problem about using jQuery (I really do not know jQuery
I have a little problem, I have an array and I want to add
i have little problem in using my application application having msaccess database if i
I have a little problem with a regex. I want to find in my
I have a little problem. I want to verify the integrity of a certificate.
I have a little problem. I want to pass two variables from PHP to
I have a little problem, I am building a database from CSV files using
ich have a little Problem to write a .net code. I have an example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.