@model CardNumbers.Objects.Client <div style="padding-left:150px; padding-top:50px; padding-bottom:50px;" id="ClientsResults"> <table id="flexClients" style="display:none"> </table> </div> <div style="display:none"> <form id="sform"> <input type="hidden" id="fntype" name="fntype"> <input type="hidden" id="Id" name="Id"> <label for="Number">Client No: </label> <input type="number" id="Number" name="Number" class="numericOnly" /> <label for="Name">Client Name: </label> <input type = "text" size =25 id="Name" name ="Name" /><br /> <label for="Contact11">Contact 1: </label> <input type = "text" size =25 id="Contact1" name ="Contact1" /><br /> <div class="float-right"> <input type="button" value="Submit" onclick="addFormData();$('#flexClients').flexOptions({ url: '/Client/Client/'}).flexReload();clearAll();$('#sform').dialog('close');"> <input type="button" value="Cancel" onclick="clearAll();$('#sform').dialog('close');" /></div> </form> </div>There is code in CardNumbers.js file that activates this flexClients grid.
@model CardNumbers.Objects.Client @{ ViewBag.Title = "Clients"; } <h2>Clients</h2> <br /> <fieldset> <legend>Search</legend> <label for="clientNo">Client No: </label> <input type="number" name="searchClientNo" class="numericOnly" /><br /> <label for="clientName">Client Name: </label> <input type = "text" size =25 data-autocomplete="@Url.Action("QuickSearch", "Client")" name ="searchClientName" /> <div> @* @using (Ajax.BeginForm("Search", "Client", new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "ClientsResults" })) { *@ <input type="button" value="Find / Refresh" id="ClientsSearch" data-url="@Url.Action("Client", "Client")" /> @*}*@ </div> </fieldset> <br /> <div style="padding-left:150px; padding-top:50px; padding-bottom:50px;" id="ClientsResults"> @*@{Html.RenderPartial("_Client", Model); }*@ </div>Finally, I attempt to associate ClientsSearch button click to show this partial view this way:
$(function () { $('#ClientsSearch').click(function () { $.ajax({ url: $(this).data('url'), type: 'GET', cache: false, success: function (result) { $('#ClientsResults').html(result); } }); return false; }); });Now, when I click on the button I see nothing - the clients grid is not shown.