I have to search an Image in the database and show it in a Jqgrid using MVC. Onclick with textbox value I am able to get it in Jqgrid but after loading the page it is getting refreshed and my grid dissappears. What to do to stay the grid in the same page when the page get refreshed.
<%Html.BeginForm("Index", "UpdateBatchStatus", FormMethod.Post); %> Image Name <%Html.EndForm(); %>
//javascript
function getstatus() {
var bim = $("#imageName").val();
alert(bim);
if(bim == "")
{
alert("Please Enter Image Name to search");
}
else{
$("#UBSList").jqGrid({
//url from wich data should be requested
url: '<%= Url.Content("~/UpdateBatchStatus/UBSDataJson?bimagename='+ bim +'") %>',
datatype: "json",
mtype: 'GET',
colNames: ['InternalBatchItemStatus','BatchItemStatusDate'],
colModel: [
{name:'InternalBatchItemStatus', index:'InternalBatchItemStatus', align: 'left',width: 20,editable: false ,sortable: true},
{name:'BatchItemStatusDate', index:'BatchItemStatusDate', align:'left',width: 20,editable: false ,sortable: true},
],
rowNum: 20,
viewrecords: true,
emptyrecords: "Nothing to display",
imgpath: '<%= Url.Content("~/Content/Scripts/themes/basic/images")%>',
sortname: 'InternalBatchItemStatus',
sortorder: "asc",
//autowidth: true,
caption: 'Batch Status',
height: 'auto',
width:400,
gridComplete: function() {
var recs = parseInt($("#UBSList").getGridParam("records"),10);
if (recs == 0) {
$("#UserGridDiv").hide();
$("#UserStatusDiv").hide();
$("#UserErrorDiv").show();
}
else {
$("#UserErrorDiv").hide();
$('#UserGridDiv').show();
$("#UserStatusDiv").show();
//alert('records > 0');
$(function() {
$("#txtStatusDate").datepicker({
showOn: 'button',
buttonImage: '/Content/Images/calendar.gif',
buttonImageOnly: true
});
});
}
}
}
);
}
}
function addstatus()
{
var URL = "/UpdateBatchStatus/Edit/";
}
//$("#Result").html(data);
//});