Community Blogs

Browse by Tags

Related Posts

  • Web Asset Enhancements in Telerik Extensions for ASP.NET MVC

    In the recent release, there has been few enhancements in the Web Asset Management. One of the new thing that we introduced which was actually requested by the community is Shared Web Asset. In this post, I will show you, how to use it in your ASP.NET MVC Application. In the previous version, you can only define the web assets either in the ScriptRegistrar or StyleSheetRegistrar like the following: <% Html.Telerik() .ScriptRegistrar() .Scripts(scripts => scripts.AddGroup("myScripts", group => group.Add("script1.js") .Add("script2.js") .Add("script3.js") .Combined(true) .Compress(true) ) ) .Render();%> if you want to reuse it in another page, you have to copy the exact same thing. Also the url...


  • Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 2

    I’m working with my Fluent-API for adding Action Filters to Controllers and Action Methods. In my previous post , I created a new instance of each Action Filter and add it to an Action Method or Controller. Based on how the Action Filters are often implemented they don’t or shouldn’t keep any state, so in that case I don’t need to create a new instance of the same Action Filter with the same configuration for each Action Method I want to add it to. I also want to have an option to have a better overview of which Action Filter is added to which Controllers and Action Methods. I have added to methods, AddFilterToControllers and AddFilterToActions:   .AddFilterToActions( new HandleErrorAttribute(), c=> c.About(), c=> c.Index()); .AddFilterToActions...


  • Fluent-API to add ActionFilters to Controller in ASP.NET MVC

    Note: The name of the classes and the methods are just temporary and may change, I’m so bad when it comes to naming classes and methods. The source code is simple and haven’t done so much refactoring etc. Just wanted to see if I could get it to work, so please have that in mind. When we create controllers for our ASP.NET MVC application we can also add Action Filters to handle cross-cutting concerns, like Authorization, Error handling and Caching etc. If we want to have Error handling on every controller we need to add the HandleErrorAttribute to all controllers, like this: [HandleError] public MyController : Controller { } By adding Action Filters by using attributes it can be hard to get a good overview of which controllers that has the HandleErrorAttribute...


  • Using Telerik MVC Grid in CRUD Scenario

    I am proud to inform you that yesterday we released our Q3 2009 version of Telerik Extensions for ASP.NET MVC. As promised this release includes: Grid Menu PanelBar TabStrip You can find the live version and source codes in the following locations: Live Version Source Code Also checkout the product home page and part-II of Tod’s unofficial faq . In this post, I will show you how to create a basic CRUD(Create/Read/Update/Delete) application with our new MVC Grid. I will be using both Entity Framework v1.0 with the default web form view engine and NHibernate with Spark to create the CRUD screens for the Customer table of Northwind database. Lets start with the Entity Framework and Default View Engine. First, lets create a new ASP.NET MVC application...


  • Using Windsor to inject dependencies into ASP.NET MVC ActionFilters

    I'm using Windsor as my IoC container for an ASP.NET MVC application .  To get dependency injection in my controllers, I'm using a slightly modified WindsorControllerFactory from Andre Loker's post earlier this year .  It works great and allows me to easily test my controllers. I've got some custom ActionFilter s that would benefit from dependency injection.  Unfortunately, ActionFilters are attributes on controllers and methods and their instantiation is controlled by the framework.  There is no extension point to allow custom creation of the ActionFilters.  So I can't do constructor dependency injection.  However, I can do the next best thing – property dependency injection! Custom Method Invoker...


  • Html Encoding Nuggets With ASP.NET MVC 2

    In a recent blog post, I introduced ASP.NET 4’s new HTML Encoding code block syntax as well as the corresponding IHtmlString interface and HtmlString class. I also mentioned that ASP.NET MVC 2 would support this new syntax when running on ASP.NET 4 . Read More......( read more ) Read More...


  • ASP.Net MVC Embedded Resource Helper Class

    Getting embedded resources such as JavaScript, CSS and image files is a little bit more difficult when using the ASP.Net MVC framework as most of the useful methods for this will not work. The only reliable way I have found it to invoke the GetWebResourceUrlInternal method via reflection on the assembly. Note: I realise there are probably better ways of doing this but I posting this as a reminder to myself more than anything. So, put your resources in the AssemblyInfo.cs folder as usual: (the following example is AssemblyName.Folder.File). [ assembly : WebResource ( "MvcWebResourceTest.Resources.MyJavascriptFile.js" , "test/javascript" )] You will need to add the following using statement System.Web.UI to the AssemblyInfo...


  • Introduction to Templates in ASP.NET MVC 2 Screen cast

    I have recorded some screen casts during the last week for Microsoft, one is was published today on Channel 9 (The Screen cast is in Swedish, I will eventually try to record screen casts also in English, but when that happens, I don’t now). You can found the screen cast here: http://channel9.msdn.com/posts/MSDNSweden/Introduktion-till-Template-i-ASPNET-MVC-2/ For those who can’t understand Swedish, here is a short summary of the screen cast. With ASP.NET MVC version 2.0 we can use templates. It will help us rendering forms etc out form the Model we passed to the View. We can easy modify templates to satisfy our needs. The simples way to use the Template feature is to use the Html’s DisplayForModel method: <%= Html.DisplayForModel() %>...


  • An xVal Provider For NHibernate Validator

    I wrote a post about a month ago about using xVal with NHibernate Validator 1.2 which solved a problem I was having upgrading the xVal ‘in-the-box’ provider to work with a newer version of NHibernate Validator . There was a caveat that my solution only worked for ValidatorMode.UseAttribute and I wouldn’t catch XML or Loquacious (or other?) validation.  This seemed to work OK, but Fabio Maulo wrote a comment to that post saying NHV has metadata which should be the same no matter which validation mode was used. So I decided to investigate how I could get the metadata without resorting to the NHibernate.Validator.Mappings validationMode specific engines (I was using ReflectionClassMapping, but there are others like XmlClassMapping). I think...


  • Create RSS and Atom feeds using custom ASP.Net MVC Action Results and the Microsoft Syndication classes

    There are many ways to create RSS and Atom feeds, in this post I’m going to show one way of creating a re-usable solution that utilises the Syndication classes from the System.ServiceModel.Web assembly. To make good use of the ASP.Net MVC framework I am going to show a nice way of creating custom action result methods to return the feeds without the need for creating any views. As this is quite a detailed overview with a fair amount of code – you can download a working solution here . The first thing to do is create the custom ActionResult methods to return our feeds. You will need to add a project reference to the System.ServiceModel.Web assembly. RssActionResult using System.ServiceModel.Syndication; using System.Web.Mvc; using System.Xml;...


Page 1 of 42 (418 items) 1 2 3 4 5 Next > ... Last »
Microsoft Communities