Geeks With Blogs
Rohit Gupta Engaging talk on Microsoft Technologies ....My Resume
June 2014 Entries
Combining jquery form serialize() and JSON.stringify() when doing ajax post in MVC
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 ......

Posted On Wednesday, June 25, 2014 9:11 AM

Downloading file using ajax and jquery after submitting form data using ajax HTTP POST in MVC
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 ......

Posted On Monday, June 23, 2014 6:31 AM

Calling a success Callback Jquery function after File Upload in MVC
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="" /> ......

Posted On Monday, June 23, 2014 5:40 AM

NHibernate Session Load vs Get when using Table per Hierarchy. Always use ISession.Get<T> for TPH to work.
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 ......

Posted On Sunday, June 1, 2014 10:41 AM

Copyright © Rohit Gupta | Powered by: