asp.net mvc - JQuery File upload dialog not returning back to dialog from MVC Controller action -


I have an ASP.NET MVC app that uses a jquery UI dialog for file upload. Everything is working fine with loading the dialog with the right content and displaying the dialog on my click event, though my problem is that when I process the action in my controlling method, I do not return to my dialogue because I expect an AJAX call like to behave. My dialogue is a form whose "method = post" I believe it is When I post the form I do not have a reference to the dialog when I remove "method = post" from my form tag, then I did not get 404 on my controller action. I would say that the work I want to accomplish is I have tried many ways to do this, but each method has not worked for one reason or another. Basically I tried the $ (post) method to urge my controller action but I found out that the request Files were not set when I tried to process my controller action, I tried to use Html.BeginForm instead of HTML, but I did not try to return to the dialogue on the same issue. The net result is a blank browser page in which there are success words, which is the return of my verb method. My latest attempt is to use the jquery method .jaxform calls it my action and the filtrate name is being uploaded but it also does not return to the dialog. Here is my code:

aspx:

  onClickButton: function () {var data = $ ("#usipgrid"). GetRowData (curro); Jquery ('# img_dialog'). Load ("/ equitytrack / GetEquipImages /" + data.equip_id, {}, function (data) {$ ("# img_results") .html (data);}); JQuery ('# img_dialog') dialog ('open'). return false; $ (Function () {$ ("# img_dialog"). Dialog ({bgiframe: true, width: 540, modal: true, autoOpen: incorrect, resizable: false}}}); $ ('# ImageDlgForm') Ajax Form ( Function (Data) {Warning (Data); Warning ("Thank you for your comment!";});  

My ASX I'm using partial view to load the dialog content):

  & lt;% @ control language = "C #" Inheritance = "System.Web.Mvc.ViewUserControl"% & Gt; & lt;% @ Import Namespace = "ULS_Site.Models"%> 
<<> & lt; Input W Size = "fileUpload" name = "fileUpload" size = "23" /> & lt; input type = "submit" value = "Save" id = "BTN service" /> gt;

& lt; center & gt; & lt; ul style = "List-style-type: none" & gt; & lt;% foreach (see Item idrame; id & gt;);%> & lt;% {%> & lt; Li & gt; & lt; Img src = "& lt;% = item.image_path%>" Alt = "" / & gt; & Lt; / Li & gt; & Lt;%}% & gt; & Lt; / Ul & gt; & Lt; / Center & gt; & Lt; Input type = "hidden" id = "hdnid" name = "hdnid" value = "38" /> & Lt; / Form & gt;

My administrator action c #:

  Upload public actions () {foreach (string input tagname} in the request} {HttpPostedFileBase file = Request.Files [ InputTagName]; if (file.ContentLength & gt; 0) {string filePath = Path.Combine (HttpContext.Server.MapPath ("..// content / equip_images"), path. GetFileName (file.FileName)); file.SaveAs (Filepath);}} return content ("success");}}  

$ To load from. It fixed my problem and returned my communication processed and expected.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -