I've got a list of items on a page, capable of being filtered by a textbox (similar to the MVC tutorial). I have a button which I would like to clear the text in the TextBox and call the controller function which will then bring the list of items back to its initial, unifiltered state.
The problem I am having is twofold: my jQuery code which clears the text of the TextBox does not clear the TextBox of the search term, and my jQuery code which explicitly passes in the empty string as a parameter to my controller does not pass in that parameter.
For example:
Page has a list of stuff.
I type "fart" in the filter box, and hit enter.
The page reloads, and the list of stuff is now filtered by "fart".
I press the Clear button.
The page reloads, but the list of stuff is still filtered by "fart", and the TextBox is not cleared.
I suspect this is all due to the TextBox not being cleared, but I honestly have no idea.
Index.cshtml
#{
ViewBag.Title = "Index";
var modelitem = new MyThing();
}
#model IEnumerable<MyModel>
<script type="text/javascript">
function fart() {
$('#reset').click(function() {
$('#filterTerm').val('');
$.get("SelectionSummary/Index", { filterTerm: '' })
});
}
</script>
#using (Html.BeginForm())
{
<div class="input-group center-block">
<h3 class="text-center">Selections</h3>
#Html.AntiForgeryToken()
#Html.TextBox("filterTerm", null, new
{
#id = "filterTerm",
#class = "form-control col-md-offset-2",
#placeholder = "Filter"
})
<input id="reset" class="btn btn-info" type="submit" value="reset" onclick="fart"/>
</div>
}
<br />
#if (Model != null && Model.Any())
{
<div class="panel panel-default col-md-offset-2" style="width:62%">
<div class="panel-body">
<br />
<table class="table table-striped text-center">
<tr>
<th>
#Html.DisplayFor(m => modelitem.NameLabel)
</th>
<th>
#Html.DisplayFor(m => modelitem.Thing)
</th>
</tr>
#foreach (var thing in Model.OrderBy(g => g.Name))
{
<tr>
<th>
#Html.ActionLink(thing.Name, "Detail", new { selectionSearchTerm = thing.Name })
</th>
<th>
#Html.DisplayFor(m => thing.Other.Name)
</th>
</tr>
}
</table>
</div>
</div>
}
else
{
<h4 class="text-center">No results</h4>
}
SelectionSummaryController.cs
public ActionResult Index(string filterTerm = "")
{
var stuff= m_repo.GetAllStuff();
if (stuff.IsNullOrEmpty()) // extension method
{
return View();
}
if (filterTerm.HasValue()) // extension method
{
stuff= stuff.Where(t => t.Name.Contains(filterTerm));
}
return View(stuff.ToList());
}
I believe your problem is in using HasValue. I would change to:
public ActionResult Index(string filterTerm = "")
{
var stuff= m_repo.GetAllStuff();
if (stuff.IsNullOrEmpty())
{
return View();
}
if (!string.IsNullOrEmpty(filterTerm))
{
stuff= stuff.Where(t => t.Name.Contains(filterTerm));
}
return View(stuff.ToList());
}
Furthermore, your javascript doesn't make sense. Why are you putting a click event handler on a button when you click the button? Try this.
<script type="text/javascript">
function fart() {
$('#filterTerm').val('');
$.get("SelectionSummary/Index", { filterTerm: '' })
}
</script>
That being said, I am not sure why you are even using that ajax get. You aren't doing anything with the data.
Related
I'm trying to provide user input from the view, call an action method from the controller, using the input to filter the model, then return the same view with the filtered model.
App View:
<div class="form-group">
<div class="row">
<div class="col-xs-3">
Enter your budget, and we'll show you all the movies you can afford:
</div>
<div class="col-xs-3">
<input type="text" class="form-control" id="budget" />
</div>
<div class="col-xs-3">
<input type="submit" class="btn" id="budgetSubmit" onclick="budgetFilter()" />
</div>
</div>
<div class="row">
<div class="col-xs-3 col-xs-offset-3">
<label id="budgetValidation"></label>
</div>
</div>
<br />
<table class="table" id="budgetTable">
<thead>
<tr>
<th>
#Html.DisplayNameFor(model => model.Title)
</th>
<th>
#Html.DisplayNameFor(model => model.ReleaseDate)
</th>
<th>
#Html.DisplayNameFor(model => model.Genre)
</th>
<th>
#Html.DisplayNameFor(model => model.Price)
</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td>
#Html.DisplayFor(modelItem => item.Title)
</td>
<td>
#Html.DisplayFor(modelItem => item.ReleaseDate)
</td>
<td>
#Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
#Html.DisplayFor(modelItem => item.Price)
</td>
</tr>
}
</tbody>
</table>
<script>
function budgetFilter() {
let budget = $("#budget").val();
if (budget != "") {
$.get("../Movies/App?budget=" + budget, function (response) {
})
.fail(function () {
$("#budgetValidation").html("No films match your budget")
});
}
else {
$("#budgetValidation").html("Please enter a budget");
}
</script>
Controller:
public async Task<IActionResult> App(decimal budget)
{
var movie = await _context.Movies.Where(m => m.Price <=
budget).ToListAsync();
if (movie == null)
{
return NotFound();
}
return View(movie);
}
I've debugged the controller and know it's working as intended. My understanding is that clicking budgetSubmit fires budgetFilter, which calls the App action method in the controller, which filters the movies model, then renders the same App view, but with the model I need to populate the table. It does work if I navigate directly to a url like "localhost:xxxx/Movies/App?budget=20". But not through the button click.
I understand I don't actually need to render the page all over again, but I don't see why the way I did it doesn't work and want to figure it out before moving on. How would you: 1. Do it the way I tried to do it, correctly, and 2. Do it a better way.
Thanks.
Your best bet might be to return a partial view from your controller
public async Task<IActionResult> App(decimal budget)
{
var movie = await _context.Movies.Where(m => m.Price <=
budget).ToListAsync();
if (movie == null)
{
return NotFound();
}
return PartialView(movie);
}
Port the dynamic bit of your view out into a partial
<div id="budget">
<table class="table" id="budgetTable">
...
</table>
</div>
In the callback of your ajax
$.get("../Movies/App?budget=" + budget, function (response) {
$("#budget").html(response);
})
This is sensible if you'd like fresh data upon each request. If you just want to return the full payload on the first call and filter client side I'd suggest looking at this
The simpliest way is just redirrect on url with budget value. Perfect works for pet\home projects.
<script>
function budgetFilter() {
let budget = $("#budget").val();
if (budget != "") {
window.location.href = `/Home/App?budget=${budget}`;
} else {
$("#budgetValidation").html("Please enter a budget");
}
}
</script>
The right way is do the same things as it does guys from Microsoft: https://learn.microsoft.com/en-us/aspnet/core/data/ef-mvc/sort-filter-page
i have problem creating view with multiple forms with in same view where i have get action for data view and post action for data collection.
Here is my main view:
#model Models.BuildingNewBuildingViewModel
#{
ViewBag.Title = "Index";
}
#if (TempData["Added"] != null)
{
<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
#TempData["Added"]
</div>
}
#if (TempData["AddError"] != null)
{
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
#TempData["AddError"]
</div>
}
<h1>Svěřené budovy pro: #ViewBag.Name</h1>
<table class="table-bordered table-responsive table table-condensed">
<thead>
<tr>
<th>Id budovy</th>
<th>Podlaží</th>
<th>Použití</th>
<th>Výměra</th>
<th>Datum</th>
<th>Administrace</th>
</tr>
</thead>
<tbody>
#for (int i = 0; i < Model.NewBuildingViewModels.Count; i++)
{
using (Html.BeginForm("Index", "Home", FormMethod.Post, new { #class = "form-horizontal", id = "Form" }))
{
Html.RenderPartial("IndexPartial", Model.NewBuildingViewModels[i]);
}
}
</tbody>
</table>
Here is form:
#model Models.NewBuildingViewModel
#Html.HiddenFor(x => x.Building, Model.Building)
<tr>
<td>#Model.Building</td>
<td>
#if (Model.Floor > 0)
{
#Model.Floor
#Html.HiddenFor(x => x.Floor)
}
else
{
#Html.TextBoxFor(x => x.Floor, new {#Value = ""})
#Html.ValidationMessageFor(x => x.Floor)
}
</td>
<td>
#if (Model.Usage != null)
{
#Model.Usage
#Html.HiddenFor(x => x.Usage)
}
else
{
#Html.TextBoxFor(x => x.Usage)
#Html.ValidationMessageFor(x => x.Usage)
}
</td>
<td>
#if (Model.Size > 0)
{
#Model.Size
#Html.HiddenFor(x => x.Size)
}
else
{
#Html.TextBoxFor(x => x.Size, new {#Value = ""})
#Html.ValidationMessageFor(x => x.Size)
}
</td>
<td>
#if (Model.Date != DateTime.MinValue)
{
#Model.Date.Date
#Html.HiddenFor(x => x.Date)
}
else
{
#Html.TextBoxFor(x => x.Date)
#Html.ValidationMessageFor(x => x.Date)
}
</td>
<td>
#if (!Model.NewBuildingDataInDatabase)
{
<button type="submit">Odeslat</button>
}
else
{
if (Model.MarksInDatabase)
{
<i class="fa fa-check checkIcon" aria-hidden="true"></i>
}
else
{
Zadat Hodnocení
}
}
</td>
</tr>
}
And my problem is when i send non valid data to controller. Validation message shows for all forms. I want to see all forms but validation messages only for form which sended data.
Here is my action:
[HttpPost]
public ActionResult Index(NewBuildingViewModel buildingNewBuildingViewModel)
{
BuildingForIcoCommand buildingForIcoCommand = new BuildingForIcoCommand();
var buildingsForIco = buildingForIcoCommand.GetBuildingListForIco(AppContext);
if (ModelState.IsValid)
{
ViewBag.Name = User.Identity.Name;
ViewModelBuilder viewModelBuilder = new ViewModelBuilder();
DaoBase<NewBuilding, int> daoBase = new DaoBase<NewBuilding, int>(AppContext.NhSession);
daoBase.Save(viewModelBuilder.CreateNewBuilding(buildingNewBuildingViewModel));
return View(buildingForIcoCommand.GetBuildingListForIco(AppContext));
}
return View("Index",buildingsForIco);
}
All of your form fields will have the name and id attributes because you are rendering them in a partial. This is why they are all flagged as invalid.
Any good solution will probably involve ajax.
One approach to revolving this would be to use a single edit form. Each rendered item would have an edit button, clicking this button would populate the form with the item's data via javascript. This could be a modal or similar. This approach works well with jQuery / unobtrusive validation.
Another approach would be to return a custom response from your controller eg status 400 and the invalid fields derived from the model state. You can then show a suitable error message in the right field.
On my Main View I have 4 partial views.. two are tables.. the others are create forms.
Partial View Table 1
#model IEnumerable<ProjectName.Models.code_AutoMake>
<h3>Auto Make List</h3>
<table id="Auto-Make-Table" class="table table-bordered table-striped">
<thead>
<tr>
<th class="col-md-5">
#Html.DisplayNameFor(model => model.AutoMake)
</th>
<th class="col-md-5">
#Html.DisplayNameFor(model => model.Active)
</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td>
#Html.DisplayFor(modelItem => item.AutoMake)
</td>
<td>
#Html.DisplayFor(modelItem => item.Active)
</td>
#if (!item.Active)
{
<td>
#Html.ActionLink("Edit", "Edit", new { id = item.MakeID }) |
Activate
</td>
}
else
{
<td>
#Html.ActionLink("Edit", "Edit", new { id = item.MakeID }) |
Deactivate
</td>
}
</tr>
}
</tbody>
</table>
Partial View Table 2
#model IEnumerable<ProjectName.Models.code_Funding>
<h3>Funding List</h3>
<table class="table table table-bordered table-striped">
<tr>
<th>
#Html.DisplayNameFor(model => model.Funding)
</th>
<th>
#Html.DisplayNameFor(model => model.Active)
</th>
<th></th>
</tr>
#foreach (var item in Model) {
<tr>
<td>
#Html.DisplayFor(modelItem => item.Funding)
</td>
<td>
#Html.DisplayFor(modelItem => item.Active)
</td>
<td>
#Html.ActionLink("Edit", "Edit", "code_Funding",new { id=item.FundID }, null) |
</td>
</tr>
}
</table>
Partial View 1 Create
#model ProjectName.Models.code_AutoMake
#using (Html.BeginForm("Create", "code_AutoMake", FormMethod.Post))
{
#Html.AntiForgeryToken()
<h3>Add Auto Make</h3>
<div class="form-horizontal">
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="row">
<div class="col-sm-12 col-md-3">
#Html.Label("Auto Make")
#Html.EditorFor(model => model.AutoMake, new {htmlAttributes = new {#class = "form-control"}})
</div>
<div class="col-sm-12 col-md-3">
#Html.Label("Active")
<div class="checkbox">
#Html.EditorFor(model => model.Active)
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-md-3">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
Partial View 2 Create
#model ProjectName.Models.code_Funding
#using (Html.BeginForm("Create", "code_Funding", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#Html.AntiForgeryToken()
<h3>Add Funding</h3>
<div class="form-horizontal">
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="row">
<div class="col-sm-12 col-md-3">
#Html.Label("Funding")
#Html.EditorFor(model => model.Funding, new {htmlAttributes = new {#class = "form-control"}})
</div>
<div class="col-sm-12 col-md-3">
#Html.Label("Active")
<div class="checkbox">
#Html.EditorFor(model => model.Active)
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-md-3">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
Main View
<div id="AutoMake" class="tab-pane fade active in">
<div id="AutoMake-Index">#{Html.RenderAction("Index", "code_AutoMake");}</div>
<hr/>
#{Html.RenderAction("Create", "code_AutoMake");}
</div>
#*Funding*#
<div id="Funding" class="tab-pane fade">
#{Html.RenderAction("Index", "code_Funding");}
<hr/>
#{Html.RenderAction("Create", "code_Funding");}
</div>
Now here is the scenario.. When I want to create a new autoMake.. I fill out the form and hit submit.. this goes through fine.. until I get back to the Main View.. specifically this line:
#{Html.RenderAction("Create", "code_Funding");}
and I get a runtime error saying:
Child Actions are not allowed to perform redirect actions
I have debugged.. and for some reason.. the HttpPost Create action for code_Funding is being hit.. even when I'm not filling out the create form for code_funding.. How is that possible?
Here are my Create Methods for code_autoMake and code_funding:
code_Funding
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "FundID,Funding,Active")] code_Funding code_Funding)
{
try
{
if (ModelState.IsValid)
{
db.code_Funding.Add(code_Funding);
db.SaveChanges();
return RedirectToAction("EditDDL", "tblNewAutos");
}
}
catch (DbEntityValidationException ex)
{
foreach (var entityValidationErrors in ex.EntityValidationErrors)
{
foreach (var validationError in entityValidationErrors.ValidationErrors)
{
Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
}
}
}
return RedirectToAction("EditDDL", "tblNewAutos");
}
code_autoMake
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "MakeID,AutoMake,Active")] code_AutoMake code_AutoMake)
{
if (ModelState.IsValid)
{
db.code_AutoMake.Add(code_AutoMake);
db.SaveChanges();
return PartialView("~/Views/PartialViews/_AutoMakeCreate.cshtml");
}
return RedirectToAction("EditDDL", "tblNewAutos");
}
Why when I try and create a new automake.. both HttpPost Create methods are hit?
Any help is appreciated.
Well, the problem is following. In your main view you have got this code:
...
#{Html.RenderAction("Create", "code_AutoMake");}
...
Which triggers the Create action which finishes with the following line of code if ModelState.IsValid == false:
return RedirectToAction("EditDDL", "tblNewAutos");
That is obviously a bad idea. Why? You are already in a process of rendering a parent view. Child actions might be a bit confusing at first because they are not real actions - no client/server communication. You are still on the server side. Therefore no redirect is allowed in the child action.
Solutions
First of all, I am not quite sure what you want to achieve so my solution recommendation might be a bit off, but let's see.
Option 1
You may want to use two different actions. One that is called on submit of the form and another one that is called from your main view. The latter one should not make a redirect - instead it should wisely choose which view to render based on the ModelState.IsValid if this is really what you need.
Option 2
There is a hack way which allows you to make redirect from a child action. Instead of making a redirect, only store information about required redirect for instance in HttpContext.Items collection. Then, implement an ActionFilter and in its OnResultExecuted event, check if the redirect request was set to the HttpContext.Items. If so, make a redirect. The ActionFilter should be applied on the parent action, not on the child action.
#{Html.RenderAction("Create", "code_Funding");}
in this RenderAction Method is call the GET request but, your controller you written only post method. and you write the
[ChildActionOnly]
public ActionResult Create(string parm)
{
reurn view()
}
and use [ChildActionOnly] this attribute is allowing restricted access via code in View.
Check and reply me..
I have a strongly typed view, which has a form in which I put one field showtime when the submit button is clicked I want to save the entry into database also display that entry along with other entries on the database inside the partial view I put on the main view . When the Index action method is called the Main view is rendered .I want to update the Partial view when a new entry is saved without reloading the whole page ,just refresh the partial page.
Here is my view :
#model Bookmany.Admin.Models.Theater.TheaterShowTimeViewModel
#{
ViewBag.Title = "Theater showTimes / BookMany";
}
<h3>Theater ShowTimes</h3>
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
#Html.ValidationSummary(true)
<div class="form-group">
#Html.LabelFor(model => model.TheaterID, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.DropDownListFor(model => model.TheaterID, Model.AvailableTheaters)
#Html.ValidationMessageFor(model => model.TheaterID)
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.ShowTimeName, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.ShowTimeName)
#Html.ValidationMessageFor(model => model.ShowTimeName)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
#Html.Partial("_TheaterShowTimeList", Model.TheaterShowTimeList)
</div>
Here is my partial view :
#model IEnumerable<Bookmany.Core.Domain.TheaterShowTime>
<table class="table">
<tr>
<th>
Theater Name
</th>
<th>
#Html.DisplayNameFor(model => model.ShowTimeName)
</th>
<th></th>
</tr>
#foreach (var item in Model)
{
<tr>
<td>
#Html.DisplayFor(modelItem => item.Theater.TheaterName)
</td>
<td>
#Html.ActionLink("Edit", "Edit", new { id = item.TheaterShowTimeID }) |
#Html.ActionLink("Details", "Details", new { id = item.TheaterShowTimeID }) |
#Html.ActionLink("Delete", "Delete", new { id = item.TheaterShowTimeID })
</td>
</tr>
}
My action method :
public ActionResult Index()
{
var model = new TheaterShowTimeViewModel();
//Bind Theater dropdown with selected value
model.AvailableTheaters = GetTheaters();
model.TheaterShowTimeList = _theaterShowTimeService.GetAllTheaterShowTime();
return View(model);
}
[HttpPost]
public ActionResult Index(TheaterShowTimeViewModel model)
{
if (ModelState.IsValid)
{
InsertOrUpdateTheaterShowTime(model);
model.TheaterShowTimeList=_theaterShowTimeService.GetAllTheaterShowTime();
return PartialView("_TheaterShowTimeList", model.TheaterShowTimeList);
}
return View(model);
}
my problems :
when I enter one value in the field and submit the form ,the entry saved now the partial view is only returned with the updated list
I want to update the partial view without reloading the whole page how do achieve that?
Like Stephen Muecke said I posted the form using ajax when the submit button clicked
<script type="text/javascript" >
$(function () {
$('form').submit(function () {
if ($(this).valid()) {
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result) {
$('#ShowTimeName').val("");
$('#theaterShowList').html(result);
}
});
}
return false;
});
});
</script>
In my action method which returns the partial view :
[HttpPost]
public ActionResult Index(TheaterShowTimeViewModel model)
{
if (ModelState.IsValid)
{
InsertOrUpdateTheaterShowTime(model);
model.TheaterShowTimeList=_theaterShowTimeService.GetAllTheaterShowTime();
//return RedirectToAction("Index", new { id = model.TheaterID });
//return Json(model.TheaterShowTimeList);
return PartialView("_TheaterShowTimeList", model.TheaterShowTimeList);
}
return View(model);
}
this resolved my issue
So in my MVC Orchard application the user chooses a location from a DD & selects a date from a datepicker. Search then looks through the DB table and returns a list of results (if any). User can then use the 'View' button to view each record on screen. This all works fine, however if the user presses the 'back' button, after viewing the record I get the error:
Webpage has expired
I've looked through other examples of GET and POST in my code and I can see no diff. does anyone have any idea why this is happening, think it is something to do with the search, please see code below
#model Project.ViewModels.SearchDeliveryRunsVM
#{
Script.Require("ShapesBase");
Layout.Title = T("Delivery Runs History").ToString();
Script.Require("jQuery");
Script.Require("jQueryUI");
Style.Require("jQueryUI_DatePicker");
}
#using (Html.BeginFormAntiForgeryPost())
{
<div>
<div style="display:inline-block">
<div class="editor-label">Delivery Run</div>
<div class="editor-label">#Html.DropDownList("DeliveryRunId", Model.DeliveryRunList)</div>
</div>
<div style="display:inline-block">
<div class="editor-label">#T("Date")</div>
<div class="editor-label">#Html.TextBoxFor(model => model.SelectedDate, new { #class = "jquery_datepicker", #Value = Model.SelectedDate.HasValue ? Model.SelectedDate.Value.ToString("dd/MM/yyyy") : string.Empty })</div>
</div>
<button style="display:inline-block" type="submit">#T("Search")</button>
</div>
if (Model.Orders != null && Model.Orders.Count() > 0)
{
<br />
<table class="items">
<colgroup>
<col id="Col10" />
<col id="Col11" />
</colgroup>
<tr>
<th>Order Id</th>
<th>Customer</th>
<th>Value</th>
<th>Payment</th>
<th>Signature</th>
<th></th>
</tr>
#foreach (Project.Models.OrderInfo results in Model.Orders)
{
<tr>
<td>#results.OrderRecordId</td>
<td>#results.QbCustName</td>
<td>#results.Value</td>
<td>#results.Payment</td>
<td>#Html.CheckBoxFor(x => results.Signature, new { disabled = "disabled" })</td>
<td>
<div>
#T("ViewOrder")
</div>
</td>
</tr>
}
</table>
}
else
{
if (!Model.IsInitialGet)
{
<p>No records exist</p>
}
}
}
#using (Script.Foot())
{
<script type="text/javascript" language="javascript">
$(function () {
var dates = $("#SelectedDate").datepicker({
dateFormat: 'dd/mm/yy'
}).val("#(Model.SelectedDate.HasValue ? Model.SelectedDate.Value.ToString("dd/MM/yyyy") : DateTime.Now.ToString("dd/MM/yyyy"))");
});
</script>
}
UPDATE
All the other search features on my site are using the Index function of each controller, then in the view using something like:
#using(Html.BeginForm("Index", "CustomerAdmin", FormMethod.Get)) {
<fieldset class="bulk-actions">
<label for="search">#T("Search:")</label>
#Html.TextBoxFor(m => m.SearchExpression)
<button type="submit">#T("Search")</button>
#T("Clear")
</fieldset>
}
to use the GET to display the results, where as my problem I am using GET and POST. perhaps?
It is normal that a page created by a POST action expires after the page is navigated away from; you wouldn't, for example, want the back button to trigger a second credit card charge attempt... You could try using output caching