Language: HTML
Implement AJAX in MVC (the View)
// The view: Index.aspx <!-- the non-AJAX form to filter the list --> <% using (Html.BeginForm()) { %> <fieldset> <legend>Search</legend> <input name="SearchTerm" /> <input type="submit" value="Go" /> </fieldset> <% } %> <!-- the AJAX form to filter the list --> <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> <% using (Ajax.BeginForm("Index2", new AjaxOptions { UpdateTargetId = "results" })) { %> <fieldset> <legend>Search</legend> <input name="SearchTerm" /> <input type="submit" value="Go" /> </fieldset> <% } %> <!-- render the partial inside the view --> <div id="results"> <% Html.RenderPartial("Search", Model); %> </div> // The partial: Search.ascx (a default LIST // T4 template, nothing special/custom)
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

