Telerik reporting in ASP.NET MVC 4 project - asp.net-mvc

I try to implement Telerik Report in my WebApp and get runtime error.
Exception Details: System.TypeLoadException:
GenericArguments[0],'BuilkReport.Areas.Report.Template.PoReport', on
'Telerik.Reporting.XmlSerialization.Current.ReportSerializable`1[TReport]'
violates the constraint of type parameter 'TReport'.
These are the methods I use:
Create a telerik report and create parameters for its constructor
Create a model using Telerik.Reporting.InstanceReportSource as one of data members
Use controller to get proper parameter for the model, then pass it to the view
These steps worked fine, with data going correctly as planned. In the view part, I use method found in this demo : http://www.telerik.com/community/code-library/reporting/general/using-telerik-web-reportviewer-in-asp-net-mvc-application.aspx
I simply copy those views into my project and pass the model from controller to be passed to ReportViewer1.ReportSource (instead of creating a new one like in the demo project)
Can anyone please help me with this? Thanks.

There is released a preview of the beta HTML5 Report Viewer - Bringing the Power of HTML5 to Telerik Reporting

Please try the steps outlined here -
http://blogs.telerik.com/careypayette/posts/13-03-26/telerik-reporting-in-mvc-sure-it-takes-8-quick-steps-

Related

MVC4 Portable Areas?

Does MVC4 remove the MVCContrib requirement to achieve portable areas? Or is that still required?
I gave it a shot w/o MVCContrib and unfortunately I'm stuck with a typical "The view 'Index' or its master was not found or no view engine supports the searched locations." exception.
The list of searched locations includes "~/Areas/Inbox/Views/Default/Index.cshtml" which is technically correct, but it's just not finding the view.
Some explanation:
I have a main MVC4 application and a "plugin" (if you will) MVC4 app that contains an area called Inbox with a controller and view named Default. I reference this plugin app in the main app and I can hit a breakpoint in DefaultController's Index method where the View is returned - so I know the main app is engaging the plugin app and routing the requests to the proper controller and all that. When not running, if I cursor over the return View() statement in DefaultController the balloon shows the desired view, it's just not found at runtime.
Has anyone encountered this? I'm sure it's something really simple and a stupid oversight on my part, but after hours of trying, I can't find a solution. Thanks in advance!
MvcContrib is not a part of MVC, so no. MVC4 does not include Portable Areas. MvcContrib is not like MvcFutures where it's likely that at some point the code will be rolled into the main project. This is code that is contributed by third parties.
For each view, edit the Properties and set the Build Action to Embedded Resource.

Error occur while adding controller

I am developing MVC 3 application and using razor syntax.(EF 4.0)
I am trying to add controller to my App. but whenever I try to add the controller I get the following error.
I am trying to add controller in test copy as well sourcesafe copy...
And the error is....
When I try add the controller in SourceSafe copy of the same application , below error comes...
How to solve it ?
Look into this article, your solution is most likely there.
Edit
Please take a look into this article dealing with specifically "Unsopported context type" during controller scaffolding: Unsupported context type in controller wizard.
Hope you can get ideas and solution from there...
Hope this helps

Creating a Basic MVC Project with Unit Tests in Visual Studio 2010

I wanted to set up an MVC 2 web application in Visual Studio 2010 using C# as the language. For that, I referred the link: http://msdn.microsoft.com/en-us/library/dd410597.aspx and I created the same. When I ran the application by pressing F5, I got an error in my browser. I have attached the error information below.
Please help me to resolve this.
MVC is different from regular ASP.NET. In MVC you are using the http-address to tell your application which method to fire in which class.
In MVC language methods are called "Actions". And classes are called "Controllers" (ruffly speaking).
If you want the first view to show, you will have to tell the class "HomeController" to perform its method "Index()".
You do this by entering the address: "localhost/Home/Index"
Please read more here:
http://msdn.microsoft.com/en-us/library/dd410269(VS.98).aspx
If your controller is called MapsController with an ViewMaps action as shown in the tutorial then you should navigate to /maps/viewmaps in your browser to execute this action.

Help migrating asp.net mvc 1 to mvc 2

I just joined a team thats developing a asp.net mvc 1 application.
I only have visual studio 2010 installed which comes with mvc 2.
I ran the conversion wizard and now the app doesnt seem to compile
The error I get is
"Cannot apply indexing with [] to an
expression of type
'System.Web.Mvc.IValueProvider"
i get this error 5 times in different places of the app.
The line is
ModelState.SetModelValue(inputTagName, new ValueProviderResult(ValueProvider[inputTagName].AttemptedValue, file.FileName, System.Globalization.CultureInfo.CurrentCulture));
To be honest I've no clue on what its doing but my peers (using Mvc 1) dont have trouble compiling.
Please help.
This is one of the (few) breaking changes between MVC 1 and MVC 2. The ValueProvider has been completely redone to support multiple value providers and no longer has an index property. The short answer is to change this to use GetValue( inputTagName ). The longer (and better) answer is to change the code to use models for your action method inputs and not pull the data out of the value provider directly in your code. Rather, you rely on model binding to access the value provider and set the properties on your model.
Change ValueProvider[inputTagName].AttemptedValue to ValueProvider.GetValue(inputTagName).AttemptedValue.
Note that your entire team should be developing against the same version of ASP.Net MVC; otherwise; you'll run into lots of trouble.

ASP.NET MVC RC - Creating a MVC User Control with a codebehind

Trying to create a MVC User Control in the Release Candidate and I can't see to make one with a codebehind file. The same is true for MVC View pages.
Creating Views in the Beta would produce codebehinds...am I missing something?
Code behind kind of defeats the purpose of the MVC Framework. Functionality should be kept separate from the view, the MVC team felt that code behind pages went against this ideology and therefore removed them.
Your can create a custom helper method to create your control. Also I'm not sure if MVC has view components (Monorail/Castle) but that could be an option as well.
From ScottGu's Blog post:
*Views without Code-Behind Files
Based on feedback we’ve changed view-templates to not have a code-behind file by default. This change helps reinforce the purpose of views in a MVC application (which are intended to be purely about rendering and to not contain any non-rendering related code), and for most people eliminates unused files in the project.
The RC build now adds C# and VB syntax support for inheriting view templates from base classes that use generics. For example, below we are using this with the Edit.aspx view template – whose “inherits” attribute derives from the ViewPage type:
One nice benefit of not using a code-behind file is that you'll now get immediate intellisense within view template files when you add them to the project. With previous builds you had to do a build/compile immediately after creating a view in order to get code intellisense within it. The RC makes the workflow of adding and immediately editing a view compile-free and much more seamless.
Important: If you are upgrading a ASP.NET MVC project that was created with an earlier build make sure to follow the steps in the release notes – the web.config file under the \Views directory needs to be updated with some settings in order for the above generics based syntax to work.*
I answered this question here:
How to add a Code-behind page to a Partial View
Seems this wasn't particularly tricky, and is quite do-able
This answer worked for a Partial 'ViewUserControl' but the same should apply
Ok.
First: Add a Class file with the convention of .cs (i.e. view.ascx.cs)
Second: Add "using System.Web.Mvc;" to the class
Third: Change the Class to Inherit from "ViewUserControl<>"
Fourth: Add the following to the View's header:
CodeBehind="View.ascx.cs" Inherits="Project.Views.Shared.View"
Fifthly: Copy the files out of the solution and drag back in to reassociate the two together
Note: For this to work with a Normal MVC View you just need to inherit the class from "ViewPage"
The whole idea for ASP.Net-mvc was to get rid of the codebehind files...thats why asp web controls didnt matter that most didn't work.But with the changes of getting rid of the code behind comes with a different programming style..The idea is codebehind files are EVIL:
http://stevesmithblog.com/blog/codebehind-files-in-asp-net-mvc-are-evil/
the whole idea is to make sure people remember they are using asp.Net-mvc and not asp.et web pages. take alook at this link ,it explains it a little better:
http://blog.lozanotek.com/archive/2008/10/20/Visual_Studio_Templates_for_MVC_Views_without_Codebehind_Files.aspx
I think this tutorial is what you are asking.. but not really sure what you want..

Resources