views:

467

answers:

2

Is there any way to use server controls in ASP.NET MVC?

Specifically I need to use the FarPoint Spread control in my application to display an Excel file that exists on the server with the ability to display updates on the client in real time.

The reason that I want to use MVC instead of webforms is that eventually we're going to scrap the excel files and create the views programmatically but I have to display these files now since we don't have time to create that functionality in this phase.

+3  A: 

My suggestion would be to use WebForms for pages that need the custom control and MVC for everything else. In order to mix WebForms in MVC in the same application you'll need an IgnoreRoute call so MVC doesn't try to process .aspx files and you need to make sure everything needed for WebForms gets added to the web.config. Scott Hanselman has a great blog post here with the details.

Anthony Conyers
A: 

I'm not sure how FarPoints control works, but if its anything like the aspose cells component I use, I dont think you'll have any problem.

As far as I'm aware, theres nothing to stop you using normal webforms controls anywhere in your MVC app, it's just that most rely on ViewState and the postback model (which arent present) and hence don't work properly.

There isnt really any UI rendered for the aspose excel control, so you should be able to just create an object, call some methods to set things up and then stream the generated file out to the response just the same way you would in a button click event.

This is all hypothetical, and I apologise in advance if this doesnt work!

Paul. http://www.tumelty.com/