how to update div tag in javascript with data from model for onsubmit form asp.net mvc

Posted by michael on Stack Overflow See other posts from Stack Overflow or by michael
Published on 2011-07-01T06:15:22Z Indexed on 2011/07/01 8:22 UTC
Read the original article Hit count: 277

In my page i have a form tag which submits to server ,gets data and redirects to same page. problem is the the div tag which has the data from server is not getting updated. how to do that in javascript

<% using (Html.BeginForm("Addfile", "uploadfile", FormMethod.Post, new
   {
       id = "uploadform",
       enctype = "multipart/form-data"

   }))
       { %>
<input type="file" id="addedFile" name="addedFile" /><br />
    <input type="submit" id="addfile" value="Addfile" />
    <div id="MyGrid">
  //data from the model(server side) filelist is not updating</div>

what will be the form onsubmit javascript function to update the div tag with the data from the model.

and my uploadfile controller get post methods are as

[AcceptVerbs(HttpVerbs.Get)]
          public ActionResult Upload()
        {
            return View();
        }
 [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult AddFile(HttpPostedFileBase addedFile)
        {
           static List<string> fileList = new List<string>();
           string filename = Path.GetFileName(addedFile.FileName);
            file.SaveAs(@"D:\Upload\" + filename);
            fileList.Add(filename);
            return("Upload",fileList);
}

thanks,

michaela

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET