Learning how to mix Telerik AJAX controls with MVC -- Seeing garbage characters? - asp.net-mvc

I am attempting to find a place to start debugging this issue at.
I do not experience this issue if I create a new, MVC2 project, but I am trying to integrate into our companies existing MVC solution.
I am adding a ScriptManager to the MasterPage. Something like this:
<telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True" EnablePageMethods="True">
</telerik:RadScriptManager>
Here is what I see when I try and run.
I'm extremely new to MVC and unsure of where/how to start debugging this. I have a hunch it has something to do with either the Global ASAX or Web Config file, but without any more information I'm not sure where to begin poking around.
Has anyone seen this before?
partial-answer: it seems that moving the script manager inside of the closing tag resolved this issue, but the second I tried to add a control to my View I am back to looking at garbage. Plus, it doesn't match what I had to do in the default app. Wondering why.

Some asp.net controls simply won't work in MVC because they rely on features that MVC doesn't support, such as viewstate. I'm not sure if the Telerik ajax controls are in this boat or not, but you can't assume any control will work. Generally, the more complex the control, the less likely it will work.
I notice that you have it working in a default project, but perhaps that project has no real data or doesn't use the same features that your production app uses.

Related

Embedding an MVC form inside the old master template architecture

I have an old Umbraco web application which was upgraded to v6 earlier this year.
It uses .NET ascx user controls and your standard .master pages as you'd expect.
I now need to create a brand new page which is essentially a booking form for an event.
I'd like to create it using MVC, as I do everything with MVC nowadays. I don't really want to duplicate the page layout / the frame. Is it possible to embed an MVC partial view inside the old master templates?
You can create the form in a .cshtml file and then add it as an Umbraco Macro. But the form couldn't use the MVC approach, it would have to be basic inline razor plus conditional statements. Which is fine but limiting. You could of course have the form posting to a controller action too but this get's a little tricky as it takes the form processing out of the page's event cycle.
Otherwise you are asking if you can reference an action in a masterpage, so no not really. I say "not really" because of course you can but it's unnatural and would make the project a nightmare for anyone to undestand of they were to pick it up. There is an article here as to how you might do it tho': http://www.hanselman.com/blog/MixingRazorViewsAndWebFormsMasterPagesWithASPNETMVC3.aspx
Also, there is also the Umbraco MvcBridge package. This was something a lot of devs used prior to being able to build directly in MVC. Essentially you can set up Macros to point to actions etc. but still within the webforms mode.
It's a great half-way house but I'm not sure abut the compatibility with v6.

Design Surface in ASP.Net MVC

Are there any recommendations for a design surface (or design tool) that could be used by a designer (the dude/dudette with the black turtleneck) in the process of building an ASP.Net MVC application?
Such that once there is agreement on the structure of the Model, and the interactions required by the app, then the designer goes away and builds out the UI (V in MVC) using this design tool, while the developer goes away and builds out the code (M&C in MVC) using Visual Studio.
As I understand it now, this designer person would also need to use Visual Studio and build the Views using Razor (or other view engine) syntax, instead of having the ability to build the Views using a design surface with drag-drop layout and property settings and the like.
I think you could ask them to give you a harcoded HTML for each view... then, you replace the harcoded data once you place it in Razor.
That is the beauty of Razor... it is very easy to pass from fixed HTML to a razor view.
Razor requires programming, and creating views is not an arbitrary task. I'd let the designer work in whatever program they like where they can excel about design and let the programmers worry about how best to create the views and programming in Razor (which is really just C#/VB with some extra syntax).
It depends.. what kind of skills does your designer have? Are they a true designer (no JS/jQuery/etc knowledge.. they live & breath PSDs) or are they a designer/front end engineer (they know js/jQuery, the diff. between IE7 and IE9 from a rendering pov).
If you've got a true designer then the best thing to get would be HTML. A PSD would be okay as well but if they can convert their design into HTML they've done a lot of the hard work for you (unless you love figuring out floats and margins and all that jazz). That said if you're using something like Twitter Bootstrap or Blueprint CSS then they would obviously have to know how to use that as well.
If you're lucky enough to have a designer/front end engineer then it's well worth your time to teach them some basic razor synax like #Url.Action and #Html.BeginForm. They can tell you the actions they need and you can work together by giving them a fake data/response version first which they can use while you create a real version. And in this case they can either use Visual Studio OR you can set it up so that they have your site hosted via IIS on their machine and they just use your source control to get latest which automatically gets placed in the right directory. Then they can just continue working in whatever editor they prefer as they should only be working in html which will get updated live. That said if you're using ASP.Net MVC 4 bundling you'll have to decide how to maintain bundles.

ASP.NET MVC View/Site Design

This stems from my question that i started at MVC Beginner Question
Im now confident in developing a MVC website from the MVC side of things.
My fatal floor now is the UI level designing. i.e. designing views and master pages including css styling.
Just wanting to get any advice on where i should start? Im currently about to look at the expression studio to see if that will help.
I need to get up and running in this quickly so that it doesnt hold back the development of the website.
Thanks in advance
I would look at a CSS grid-framework like 960 Grid System or Blueprint.
There is often controversy from CSS/Markup purists as to whether the use of such frameworks is valid, but they often overlook that not everyone is a CSS expert. I have found that the use of these frameworks has saved me hours of productivity since my CSS skills (as a programmer) are not that great.
As far as using Expression, I tend to use this as a "test-bed" with simple HTML files. The Designer and CSS Style support seem to be more interactive than that which Visual Studio supports, so for quick mock-ups -- Expression, then move that HTML/CSS over to VS as soon as possible.
One other priceless tool to use while designing is the add-on "Firebug" for Firefox ... it allows you to inspect single elements on your page, the CSS properties affecting that element - it even allows you to change CSS attributes "on-the-fly" to immediately see the ramificatiions. This tool has saved me HOURS!
Consider finding a suitable theme in a free open source template.
Consider something that suits at http://www.freecsstemplates.org/.

Why are there so many javascript files in my empty MVC 2 project?

When creating an empty MVC 2 project, I have a lot of javascript files in my Scripts folder. Why? Will removing them affect my application?
No removing them won't affect anything, unless they are being used in pages. However you said this is an empty MVC project so you'll be fine.
They're there for you to use, to make your life easier. For example, JQuery is included.
Take for example JQuery file, It provieds functions which has solutions for crossbrowser related issues which makes developement easy. Similarly other files has functions whcih are providing readymade functionalities which can be used for rapid developement.
Unfortunatly as JS is traveling to browsers its downloaded on the client. Its suprising for not JS people as its not like .NET api where one or more dll is sufficient for all the api and developer dont have to worry(some times :)) about from where they are coming.
I will suggest you to study included JS files and include/use only those which you really wanted to use.

MVC Views with the Same Name Issue/Bug

I have been using ASP.net MVC for a new website.
I have found a minor nagging issue with having views with the same name but are in different folders i.e. Views/Home/Index.aspx and Views/Account/Index.aspx
The codebehind files act as if they are partial classes when there is a definition for the same event or function (i.e. PageLoad event). I have avoided this issue by explicitly providing a Namespace to the codebehind file (using the Folder name) and updating the reference in the markup page.
But like i said, this is annoying. Is there something i'm not doing correctly? or is this just a bug in beta software?
No, this is not a bug in the beta software. It has nothing to do with MVC specifically or ASP.NET in general. Essentially, your problem boils down to you wanting to have two distinct classes with the same name. The only way to do this is to put them in different namespaces.

Resources