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 6608081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:34:19+00:00 2026-05-25T19:34:19+00:00

I am using mvcContrib to generate a grid to allow users to filter data

  • 0

I am using mvcContrib to generate a grid to allow users to filter data by keying in search data. There are several partial views that are rendered in my Index View:

Here is the partial view that handles the searching:

@model CRMNPS.Models.PagedViewModel<CRMNPS.Models.NPSProcessed>
@using (Html.BeginForm("Index", "Home", FormMethod.Get))
{

    <label>
Model Number:&nbsp;&nbsp; @Html.TextBox("searchWord" )
<br /><br />From Date:&nbsp;&nbsp;&nbsp; @Html.EditorFor(m => m.FromDate)
</label>
<label>
<Br /><br />To Date:&nbsp;&nbsp;&nbsp; @Html.EditorFor(m => m.ToDate)
</label>    
<label>
<br /><br />&nbsp;&nbsp;<input class="button" value="Search" type="submit" />
<br />
</label>

}

Here is my Index view:

@model PagedViewModel <CRMNPS.Models.NPSProcessed>

@{
    ViewBag.Title = "CRM Processed List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<h2>Processed List</h2>
@{Html.RenderPartial("SearchBox");}
@{Html.RenderPartial("Pager", Model.PagedList);}
@Html.Grid(Model.PagedList).AutoGenerateColumns().Columns(column =>{
column.For(x => Html.ActionQueryLink(x.ModelNumber, "Edit", new { id = x.Id
})).Named("Id").InsertAt(1);
}).Sort(Model.GridSortOptions).Attributes(@class => "grid-style")

@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { FromDate = Model.FromDate, ToDate = Model.ToDate, SearchWord = Model.SearchWord }))
{
   <p>
       <input class="button" value="Export to Excel" type="submit" />
   </p>
}    

At the bottom of the Index View I have another submit within the Html.BeginForm with a Formmethod.Post.

The Index ActionResult that calls this view passes a viewmodel with the search criteria and a IQueryable object that the mvcContrib uses.

When the user presses the Export to Excel push button I would like to pass the selected values back to the Index actionresult HttpPost controller. (FromDate, ToDate and SearchWord)

The FromDate, ToDate and SearchWord values always come back null.

I am fairly new to MVC so any constructive comments are welcome.

Thanks

Joe

  • 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-25T19:34:19+00:00Added an answer on May 25, 2026 at 7:34 pm

    Since they are not in the form that you are posting – (Export to Excel is in a separate form).
    The inputs

    FromDate, ToDate and SearchWord

    Are in the first form (in the partial view). So those values don’t show up in the controller (since they are not part of the http post).
    If you want to see all these values being passed back to the controller, they should be under one

    Html.BeginForm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the filter from MvcContrib which causes nice error pages, my own views,
I am using the Sort method of the MvcContrib Grid to generate sorting links,
I have the following partial view code @model IEnumerable<PDoc.Web.Models.UserDocModel> @using MvcContrib.UI.Grid; @using MvcContrib.UI.Pager; @using
I'm using the MVCContrib grid to output some data. When I sort a column,
I'd like for my column header to also be footers using MVCContrib grid. How
I just started using the MVCContrib grid in a test project. I'm having a
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I am using the MvcContrib Grid to display a table on the page. I
I am using the MVCContrib grid and I would like to display images depending

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.