views:

196

answers:

1

Is this possible? if so, what adjustements do i need to make in order to do this properly. I know i can run webforms and mvc views in seperate files, but i want to run the web server control output and events in/on the mvc view page, however, i keep getting this compiler error:

    Line 38: <CuteWebUI:Uploader ID="UploadPic" runat="server" UploadType="IFrame" 
Line 39:       FileTooLargeMsg="{0} cannot be uploaded! File size ({1}) is too large. The maximum file size allowed is set to: {2}." 
Line 40:       TempDirectory="~/UserData/Images/TemporaryImages" UploadingMsg="Uploading..."

    C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0> "C:\Windows\Microsoft.NET\Framework\v4.0.30128\vbc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity.Design\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.Design.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Web.Entity.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" /R:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\assembly\dl3\1ebf4e16\00022dff_30cfca01\CuteWebUI.AjaxUploader.DLL" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_global.asax.dwhl4wn6.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\assembly\dl3\f5e0c238\003699d9_86d1ca01\LSL.DLL" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Linq.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_Web_zkzcodji.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /out:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_Web_tptbtllk.dll" /D:DEBUG=1 /debug+ /win32resource:"C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\tptbtllk.res" /nowarn:41008 /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Collections.Specialized,System.ComponentModel.DataAnnotations,System.Configuration,System.Data.Entity.Design,System.Data.Linq,System.Linq,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.DynamicData,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls,System.Xml.Linq,System.Web.Mvc,System.Web.Mvc.Ajax,System.Web.Mvc.Html,System.Web.Routing /warnaserror- /optionInfer+  "C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_Web_tptbtllk.0.vb" "C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_Web_tptbtllk.1.vb" "C:\Users\Jay\AppData\Local\Temp\Temporary ASP.NET Files\root\6ea46d42\947d937c\App_Web_tptbtllk.2.vb"


Microsoft (R) Visual Basic Compiler version 10.0.30128.1
Copyright (c) Microsoft Corporation.  All rights reserved.

X:\!My Programs\Web Sites\LSL\Views\Home\Index.aspx(38) : error BC30456: 'OnFileUploaded' is not a member of 'ASP.views_home_index_aspx'.

            AddHandler __ctrl.FileUploaded, AddressOf Me.OnFileUploaded
                                                      ~~~~~~~~~~~~~~~~~
X:\!My Programs\Web Sites\LSL\Views\Home\Index.aspx(38) : error BC30456: 'OnFileUploaded' is not a member of 'ASP.views_home_index_aspx'.

            RemoveHandler __ctrl.FileUploaded, AddressOf Me.OnFileUploaded
                                                         ~~~~~~~~~~~~~~~~~

i don't know what else do do, it just wont recognize the control name when im writing the event signature, right after the "handles" keyword, comes the server control name and then a dot, and then the event name, but as events its just giving me "Me", "MyBase" and "MyClass" options to run events for... doesn't let me access "FileUpload.OnFileUploaded" which is the control name & event name i want to write the sub routine method declaration (and subsequently method) and signature for.

+1  A: 

I don't think you can do this

Perhaps you could make it compile by adding a code-behind for your view, and adding the method, that you are trying to hook up to the event.

But remember, the MVC page lifecycle is very different than the one of WebForms. Most WebForms controls depends on the WebForms lifecycle to do their work; and if the right events don't get fired, etc, the control will fail. Also, a simple thing as missing the viewstate in MVC will create problems for many controls.

If you really want to; perhaps you can make all the plumbing work required to satisfy your control. But it will be a lot of work, without any real benefit. I think you are better off making the Page a normal WebForms Page, if you really need to use that control. (I think there are good, free file-upload controls available for MVC you could use instead).

Please see the ASP .NET WebForms Page Lifecycle, as opposed to the MVC Page Lifecycle, and this question.

driis
i've searched for a long time in the past, and not as much recently for a good ajax enabled (async) file uploader (without making full postback) which will support multiple file selection from the selection/dialog box. and return percentage (%) information, and have found nothing with all three requirements. if anyone has, do let me know. the new ajax controltoolkit built in one doesn't do either of the last two :(, there are some codeplex ones, but either poorly described or require exhaustive extention.
Erx_VB.NExT.Coder
also, re codebehind, this is how i have done it, just specifying the codebehind attribute in the index.aspx view page. it seems to want to work, but just the events aren't hooking up. i'm almost certain it may work if we get past this.
Erx_VB.NExT.Coder