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.
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.
FarPoint recently released a Spread component which is supported on the MVC platform .You can go through which blog which gives detailed information on using Spread with MVC 3 .I hope this helps.
http://www.gcpowertools.info/2011/12/using-grapecity-spread-for-net-with-mvc.html
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/
Related
I was wondering if anyone knew of a good way to help me navigate a MVC ASP.Net solution.
Here is the set up:
I have a MVC ASP.Net Web Project that calls and references a WCF service.
Is there a easy way to link the javascript ajax calls that call the controller actions, and then from the controller to the WCF service.
VS is great about the goto definition but that breaks down with both javascript and WCF.
Is there a way to add a comment that you can click on that will take you a method in a certain class?
I always use the CTRL+,(comma) shortcut when I have my cursor on the name of the c# method I want to browse to as a shortcut. This brings up the Navigate To UI element, and shows you methods, fields, properties, and files that match the item under the cursor, or highlighted text.
I have successfully developed a simple grid using MVC 4 and kendo UI. Everything works as expected and I dont have an issue with it. The other day, I was talking to another developer who told me that I could completely bypass MVC and just use a Javascript to read from SQL Server(my data source) and call it on my HTML page. There, I could use Kendo UI helpers to display the page the way I wanted.
My question is, is that possible? And if it is possible, is it advisable? I primarily work only with databases and this is the first time I am playing with MVC, Kendo and HTML as such, so please bear with me.
Thanks for the help.
Your colleague is absolutely right. You can use the client version of Kendo UI and write jQuery code on HTML/.cshtml/aspx... files and connect to your MVC/Web API controllers or a RESTFul/HTTP service using Ajax calls. This will work like a charm.
This is advisable only if you are good with Javascript/jQuery. This method will provide better user experience and you can easily build Single Page Applications which is the future of web apps.
if you see Kendo UI demos, all the examples are built on pure HTML pages using jQuery.
I hope I answered your question clearly, but in case you need any clarifications, feel free to ask.
I need to implement an MVC JavaScript framework for my next project, but it's as much as a website as it is a web app. Is it possible to expose the data server-side, then parse the URL to show the 'JS version'?
(I plan on using Rails for server-side code)
I wrote a small blog series on exactly this subject...
The first part introduces the problem and the previous solutions, as well as the current solution: HTML5's PushState (history API)
http://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-1-introducing-pushstate/
Part 2 shows how to use progressive enhancement with Backbone, so that when you have your server render HTML you can then have your Backbone code take over the existing HTML content instead of rendering new content:
http://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-2-progressive-enhancement-with-backbone-js/
Part 3 is a (slightly blurry) video of a presentation I gave on this subject, at a conference:
http://lostechies.com/derickbailey/2011/10/06/seo-and-accessibility-with-html5-pushstate-part-3-the-video/
And while it's not directly a part of this little series, I also wrote a blog post about using Routers with PushState. The gist of that post is: you don't need a router:
http://lostechies.com/derickbailey/2011/10/17/tips-for-using-backbone-js-routers-with-html5-pushstate/
Hope that helps
Im not really sure if I understand your question the right way. I think you have some data and you want to work with it on the server side using rails and then provide it to your javascript and proceed working with the data? Thats right?
Then yes thats possible. Lets say you have a model called article and you access one article by the following url:
http://site.com/articles/1
then you can add an .xml
http://site.com/articles/1.xml
and you will get xml and of cause Javascript can parse xml. This is the default setting of rails.
i am building a site. There are two choices for me.
asp.net mvc 3.0 + ajax.
build whole site with ajax(javascript). Firstly, use ajax to get data with json format, and then fill the whole page with the data. In this way, the page will be produced only via javascript.
Could anyone tell me the advantages and disadvantages of these two ways?
Thanks in advance.
Javascript is not for building entire markup and rendering it. Don't shoot yourself in the foot.
Use ASP.Net MVC to build your site. Along side of ASP.Net MVC use jQuery/javascript to build ajax functionality.
If you choose the second option, it won't work in browsers with no JavaScript support. This may not seem all that important to you, but consider: most search engines don't support JavaScript. If search engines can't get the content on your site, it won't get ranked well.
I am in charge of converting an ASP.NET web application into fully AJAX based application. I know Javascript and Jquery very well.
Initially I thought to point every anchor tag's click event to JS function and to call stuff via ajax and to populate the body and so on. I encountered a problem when it came to ASP.NET Form on every page and when there was need to make a post-back. I decided to point every Form tag's onSubmit event to a JS function to post stuff using ajax and to get results and I got to know this is not possible with ASP.NET as every time where is a button click, there will be post back so it's hard to let page know what button was clicked.
I then decided to use ASP.NET built-in AJAX controls to use with Forms which is pretty easy and worked like the way they should.
Now I am stuck with the question of which I should go with?
I like to be JS way because it's more customizable than AJAX.NET. I highly need your suggestions.
I don't see a problem in using ASP.NET Ajax. The scriptmanager and UpdatePanel controls will make you task easy and fast to convert to and ajax enabled website.
I am not sure what kind of customization you are looking for but you can still use js way whereever necessary. One another plus point with ASP.NET Ajax is it is well tested and used by thousands of sites and comes with lots of controls like in ajaxcontrol toolkit.
If you want to convert a web forms application completely to JavaScript coding, this is going to be really hard to do. It would be a lot easier to use the updatepanel control to make it look asynchronous to the user, as this doesn't break the server-side integration. But if you are using JS to post back to the server, then wipe the UI and replace it with the new one every time, that's going to be a lot harder.
Ideally, the best way is to use web services, call the web services through JS code (either JQuery or using the Sys.Net.WebServiceProxy ASP.NET AJAX object) to stream the data and you build the client in JS.
Let me know if you want more info...
HTH.