|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Does the ajax uploader support .net mvc?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe so. ASP.NET MVC does not change fundamentals related to server controls. You should be able to put server controls into your views and it should work just fine.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
I don't believe that will work because the views don't have code behind.
I've used EO's uploader in my web forms project and it worked great. I would like to use it my MVC project but I don't see how it's going to work. ajaxuploader.com seems to have adapted their web forms control for mvc but their support terrible. You guys have a good market opportunity if you choose to pursue it.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
cn wrote:I don't believe that will work because the views don't have code behind. Hi, That is not true. Not being able to use code behind would have been terrible restrictions. In fact if you just place an uploader into your view and you should be able to switch to the event tab in property window and double click FileUploaded to create an event handler in the page. Everything is very much the same as a Web Form in this regard, the only thing you need to check is whether you have a form element in your View. All server events go through postback and all postback goes through a form. So if you don't have a form in your page, then the uploader won't work (and other server controls). An easy test for you is to try to get a standard Button control works first. Once Button works, other server events should work. I am not sure why other vendors need to make changes to their product to work with MVC. But ours should work just out of box. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Thank you. I added the control to my webform and it seemed to work although I still have a few plumbing details that are not that obvoius to me. Hopefully you can help?
In my webform implementation I had a function in the code behind that was called by the contorol using the "onfileuploaded" event. I would then access the file collection in the code behind.
How can I handle this in the MVC implementation? In a perfect world I would be able to acess the file collection in the controller.
Thanks, Chris
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Chris, You just do it inside the same page. Something like this:
Code: HTML/ASPX
<script runat="server">
protected void Uploader1_FileUploaded(object sender, EventArgs e)
{
.....
}
</script>
<eo:AJAXUploader OnFileUpload="Uploader1_FileUploaded" ...>
.....
</eo:AJAXUploader>
It's exactly the same as Web Form except that unlike with WebForm you usually put the code into a separate .cs/.vb file where as with Views, you usually put them inside the same file, But this is just how the wizard works and I do not think this has anything prevent you from putting code in a separate file. both are valid ASP.NET syntax. Basically once you put a form element into your view, you would pretty much just treat it like a web form. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
OK, I got everything to work with one exception. I can see the temp file in my upload directory but I'm not sure how to determine which file is associated with the upload being made. The temp files have long names that don't resemble anything uploaded in the form.
Thanks, Chris
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
OK. Everything works now. I basically copied the code from .mvc controller class into a script container in the view and then wired the ajax uploader control side events to provide form validation. It all seems to work very well. Thanks. I did have a diffcult time formatting the control itself. It does not quite match the rest of the formating on the page but it's good enough for now. You can see it https://www.accurateappend.com/Batch/UploadFile/PhoneAppend. Thanks a lot for your help.
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Hi,
It's been a year since this post and today I upgraded by website to .NET MVC 2 which uses .NET 4. When running the site I received an error stating the version of the older version object would not work with .net 4.
As a remedy I purchased the newest version of the object installed it in my IDE. The documentation didn't contain instructions specific to .net mvc so I'm not sure I installed it correctly and my application is not currently running.
Here's what I did:
1) Downloaded the installer package from your site and ran on my dev server. 2) Ran the license manager using the key I downloaded from your site. 3) I created a standard ASP.NET project and dragged an AJAX Uploader from the toolbox into a new page. 4) Copied the dll from the ASP.NET project into my MVC project. My old object had a license file and I did not see a license file for the new object so I assumed the license is somehow baked into the assembly.
My page will now compile but the OnUpload event does not seem to fire.
Where am I going wrong?
Thanks, Chris
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Thank you very much for your business. The same setup should work. The main difference between the new version and the old version is the new version now supports .NET 4.0. However the uploader still works very much the same. The original rules concerns to MVC (requires a form element) still applies. As a simple test, you can see if place a standard button along with the uploader and see if that fires Click event. If that does not, then most likely you do not have a form in your page.
The license file is NOT in the assembly. So you will still need to go to your license key page to download the file and place it either at your bin directory or root directory.
If you still have problems, you can try to isolate the problem into a test project and send it to us. We will be happy to take a look as soon as we have that.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Thanks. I've created a test project that duplicates the problem. How should I send it to you?
Thanks, Chris
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, We have looked into the problem. It appears that MVC2 broke the standard ASP.NET WebForm post back (maybe intentionally, we are not sure). However you can restore the normal page flow by adding the following code into your page:
Code: C#
public override void RenderView(ViewContext viewContext)
{
ViewContext = viewContext;
InitHelpers();
ProcessRequest(HttpContext.Current);
}
This would override the default RenderView method. It should re-activate all server events, not just server event for our controls. Thanks!
|
|