Note that there are some explanatory texts on larger screens.

plurals
  1. POissue with fileUpload in MVC if site.master contains <scriptmanager>
    primarykey
    data
    text
    <p>iam working on fileUpload in mvc. my code is as follows:</p> <p>Views/Client/AddClient.aspx</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;Auditz.UI.Web.Automation.ClientService.ClientDto&gt;" %&gt; &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;h1&gt; Add A Client&lt;/h1&gt; &lt;% using (Html.BeginForm("AddClient","Client",FormMethod.Post,new {enctype = "multipart/form-data" })) { %&gt; &lt;%: Html.ValidationSummary(true) %&gt; &lt;div class="tabcontrol"&gt; &lt;asp:Panel ID="pnlClientDtls" runat="server"&gt; &lt;asp:TabContainer ID="TabContainer" runat="server" Width="100%" ActiveTabIndex="1"&gt; &lt;asp:TabPanel ID="tb1" runat="server"&gt; &lt;HeaderTemplate&gt; Client Details &lt;/HeaderTemplate&gt; &lt;ContentTemplate&gt; &lt;div class="formelements"&gt; ..................... .............. &lt;/div&gt; </code></pre> <p>Controllers/FileUploadController.cs</p> <pre><code> namespace FileUploadTest.Controllers { public class FileUploadController : Controller { // // GET: /FileUpload/ public ActionResult FileUpload() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult FileUpload(HttpPostedFileBase uploadFile) { if (uploadFile.ContentLength &gt; 0) { string filePath = Path.Combine(HttpContext.Server.MapPath("~/Uploads"), Path.GetFileName(uploadFile.FileName)); uploadFile.SaveAs(filePath); } return View(); } } } </code></pre> <p>Evrything works as desired with this code. But if i place and in of Shared/Site.Master,iam getting null value in "HttpPostedFileBase uploadFile".</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt; &lt;/asp:ScriptManager&gt; &lt;/form&gt; &lt;div&gt; &lt;asp:ContentPlaceHolder ID="MainContent" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/div&gt; </code></pre> <p>i cannot remove from my code as i want to add few ajax controls.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload