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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:13:12+00:00 2026-06-11T08:13:12+00:00

I have got a view with search options to filter results: @model GWeb.Models.FilterModel @using

  • 0

I have got a view with search options to filter results:

@model GWeb.Models.FilterModel
@using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend>Search criteria</legend>

                @(Html.Telerik().ComboBox()
                    .Name("UserName")                
                    .BindTo(new SelectList(ViewBag.workerList as System.Collections.IEnumerable, "Id", "Desciption"))
                .Value(Model.UserName))

                @(Html.Telerik().DatePicker()
                .Name("StartWork")
                .Value(Model.StartWork))

                @(Html.Telerik().DatePicker()
                .Name("EndWork")
                .Value(Model.EndWork))       

                <input type="submit" value="Filter" />

        </fieldset>   
    }
    @{Html.RenderPartial("EmployeeList", (IEnumerable<GWeb.Entities.Work>)ViewBag.employeeList);}

RenderPartial is a list of items that can be edit:

<td>
<a href="@Url.Action("Edit", "Admin", new { id = item.Id })">
    <img src="/Content/edit.png" alt="Edit" title="Edit" width="22" height="22" />
</a>

Edit view is standard scaffold generated view.
FilterModel contains:

public class FilterModel
{
    public string UserName { get; set; }
    public DateTime? StartWork { get; set; }
    public DateTime? EndWork { get; set; }
    //...
}

The problem: When I edit one of the items and go back to main view the search ciriteria are gone. How can I remember values that were set to FilterModel? So that after editing or viewing item from list I could get back to the same filter options that I have set before?

Any help much appreciated!

  • 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-06-11T08:13:13+00:00Added an answer on June 11, 2026 at 8:13 am

    This is a common scenario. I usually have search forms submit using GET rather than POST (default) and store the Request.UrlReferrer in HttpSession. Then use this session value for cancel and redirect actions.

    here is an example:

    <form action="~/Search/Index" method="GET">
         ...
         <submit />
    </form>
    
    class SearchController : Controller
    {
         public ActionResult Index(FilterModel model = null)
         {
             Session["SearchUrl"] = Request.UrlReferrer.ToString();
             var results = get page of results...
             return View(results);
         }
    
         [HttpPost]
         public ActionResult Edit(EditModel model)
         {
             //update the model...
    
             return Redirect(Session["SearchUrl"]);
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing iphone application using makkit framework. I have got the map view integrated in
I have finally got a zend view helper working using this in my helper
I have got a problem to get back a parameter from my view to
In a certain view I have got different elements and I need the keyboard
I have got a dropdownlist, a submit button and a textbox in my view.
I have the following problem: I got a view with two text fields and
I've got a grid view. I want it to say you have nothing to
I have an app that I just got setup with a split view controller
I have a button in a view which refuses to work. I've got in
I've got a table using NSFetchedResultsController to automatically populate and update the table view.

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.