Most of the times we end up using either $(‘#myform’).serialize() along with default contentType in ajax POST request, OR we use the JSON representation of the form using jquery helper methods, then call JSON.stringify(formData) and then set contentType = “'application/json; charset=utf-8’” inorder to submit form data to the MVC Controller. The JSON jquery helper is as shown below: 1 $.fn.serializeObject = function () { 2 var o = {}; 3 var a = this.serializeArray(); 4 $.each(a, function () { 5 if ......
Many a times we find a need to download a file on doing a AJAX POST request. Normally we would just use the Response.Write to write the fileStream to the MVC Output response, as follows: 1 [AcceptVerbs(HttpVerbs.Post)] 2 public FileContentResult FunctionA(string A, DateTime B) 3 { 4 try 5 { 6 string csv = "Make it downloadable "; 7 var filresult = File(new System.Text.UTF8Encoding().... "application/csv", "downloaddocuments.csv"); 8 // return filresult; 9 10 Response.Clear(); 11 Response.Buffer ......
Many a times there is a need to call a function after successfully uploading a file in MVC using form submit. Thus your HTML code will look something like the following for uploading a file: 1 <form class="item-add" action='@Url.Action("Upload... "Upload", new { area = "Masters" })' enctype="multipart/form-data" id="ImgForm" method="post" name="ImgForm" target="UploadTarget" novalidate="novalidate"> 2 <input type="hidden" id="uploadFileFormat" name="uploadFileFormat" value="" /> ......
NHibernate ISession has two methods on it : Load and Get. Load allows the entity to be loaded lazily, meaning the actual call to the database is made only when properties on the entity being loaded is first accessed. Additionally, if the entity has already been loaded into NHibernate Cache, then the entity is loaded directly from the cache instead of querying the underlying database. ISession.Get<T> instead makes the call to the database, every time it is invoked. With this background, it is ......