.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

MVC3 Preview - Suggestions and a bug

Posted By:      Posted Date: October 03, 2010    Points: 0   Category :ASP.Net

I have a few suggestions regarding the MVC3 preview:

1. I don't believe having a alias for ViewData called View is correct. It is going to cause confusion across teams or within teams on the same project. I can appreciate writing less code, but I don't believe writing View versus ViewData is really any help. You guys have done a great job with the Razor syntax, but I think there is such as thing as taking it too far. Next thing you know, RenderBody() because rb() and @section becomes @s and so on. I'd hate to see MVC going down this route.

2. I feel that one should be able to put the open curly on the line after the @ symbol, so that code can be aligned correctly and curlys can be aligned correctly. for example in multi-line statements, I'd like to be able to do the following



    View.Title = "ooblx - The Knowledge sharing platform";
    LayoutPage = "~/Views/Shared/LayoutSite.cshtml";    

    View.Title = "Razor is great!";

    LayoutPage =

View Complete Post

More Related Resource Links

July preview of POP Forums v9 for ASP.NET MVC3 posted to CodePlex

Here it is, the third preview release of POP Forums v9. It's starting to smell like a real application now. New since the last release: Text parsing of HTML and "forum code" Dropped in TinyMCE text editor (still needs some customization and option for plain text) Security logging User profiled editing, for the users and admins, including avatar and photo uploads Admin pages for most of the forum settings, including category and forum management E-mail confirmation for new accounts, with verification mechanism View counting Runs on ASP.NET MVC3 (see notes below) Lots o' refactoring and more unit tests (now over 400) Other notes Keep in mind that this is still a preview, it's way rough around the edges, and it's in dire need of additional refactoring. This release requires ASP.NET MVC3, which is itself in preview mode. The views have not yet been converted to use the Razor view engine (because it's slightly hard without the tooling), but the dependency injection features are used here, and that's some delicious goodness that allowed for the destruction of much code. Look for the Ninject implementation of the service locator interface to see how it works. The unfortunate piece of this is that it throws exceptions on every request (and eats them) because the interface requires the throw when it doesn't find an implementation of the controller factory. That's

Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

Problem upgrading to MVC3 - System.Web.Routing



I'm trying to upgrade to .NET 4 and MVC 3.

When trying to compile my project, I get the error:

Error 1 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\spencer\Desktop\weblauncher\Common\MVCConfig.cs 4 18 Common

The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

I do have the System.Web.Routing in my references for the project.

BUT - when I try to view System.Web.Routing in the OBJECT BROWSER, nothing is inside!  The System.Web.Routing namespace is not in there - the entire thing is empty!  Could it that the dll is corrupted?  I tried to reinstall the .NET 4 and MVC 3 stuff, but its still empty!

The dll is coming from here:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Routing.dll

and the runti

Localizing RequiredAttribute ASP.NET MVC 3 Preview 1



Has anyone got the Localization working for the RequiredAttribute? 

The below DisplayAttribute is localized properly but the RequiredAttribute is not. Any ideas?

[Required(ErrorMessageResourceType = typeof (Account), ErrorMessageResourceName = "ErrorNotation")]
[Display(Name = "UserName", ResourceType = typeof(Account))]
public string UserName { getset; }

Need suggestions on Online Exam Application



I am thinking about creating an online exam application  using asp.net + C # and Server. To do this need some suggestion and help from experts.

My requirements are:-


  1. All Questions and answers will be stored in sql server database.
  2. Questions should be choose randomly for each candidate.
    • What method should I use to choose the questions randomly?
  3. If anything  happened unexpectedly and application get closed during the online exam .I need to get the same group of questions for the specific candidate
    • How can we handle these kind of situation

Vista and Office: View Data Your Way With Our Managed Preview Handler Framework


Stephen Toub shows you how to write your own Preview handlers for Windows Vista and Outlook 2007.

Stephen Toub

MSDN Magazine January 2007

Printing: Preview and Print from Your Windows Forms App with the .NET Printing Namespace


Printing is an integral part of every complete Windows-based application. Providing robust printing capabilities in these applications has often proved to be a tedious chore. Now, printing from Windows Forms with the .NET Framework means you must adopt a document-centric approach, resulting in cleaner and more manageable code. While the System.Windows.Forms namespace provides seamless integration with all the standard print dialogs (such as Print Preview, Page Setup, and Print), the System.Drawing.Printing namespace offers numerous classes for extensibility and customization. These classes, and how they provide access to printing capabilities, are covered here. Other useful techniques, such as printing in the background to allow the user to continue other tasks, is also explained.

Alex Calvo

MSDN Magazine February 2003

MVC 3 Preview 1. Inject value in Action Filter



I was reading MVC3 Preview 1 release and I found this:

Dependency Injection at all levels - We opened up seams for applying the dependency injection when instantiating components of the framework. This allows developers to hook into the creation of models during model binding, action filters, etc.

Does that mean I can inject a value into an Action Filter?

This is a problem I have for a long time and it would be really useful.

How can I do this?



Will MVC3 make possible to use IOC with Action Filters



Will MVC3 make possible to use IOC with Action Filters?

Is this on the roadmap?



MVC3: Define Dynamic ViewModel property inside Action Filter



How can I define a Dynamic ViewModel property in MVC 3 inside an action filter?

I am looking to have something like but inside the ActionFilter and not in the controller:

ViewModel.Title = "Home";

Thank You,


ASP.NET MVC3 Areas and Razor views produce errors?


The view at '~/Areas/SomeArea/Views/List/Index.cshtml' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl.

The project structure is pretty much default. There is one area called SomeArea. It has a single controller called List. It does nothing except:

public ActionResult Index()
    return View("~/Areas/SomeArea/Views/List/Index.cshtml");

The view looks like:

@inherits System.Web.Mvc.WebViewPage<dynamic>
    View.Title = "Index";
    LayoutPage = "~/Views/Shared/_Layout.cshtml";


I have tried emptying the entire file part by part and nothing seems to help. If I create a controller and view outside the area it works just fine. If I create an aspx view it works fine as well. Is it possible the default razor view engine doesn't support areas at this time?

The areas are registered too.

public static void RegisterRoutes(RouteCollection routes)
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters

Making auto suggestions more appropriate for your textbox

To round out my coverage of Input Contexts we need to cover the concept of Input Classes. Put simply an input class is a hint to the Windows Mobile OS as to what kind of information should be entered into a text box (for example an email address, phone number, or person's name).

Selecting an Input Class for a textbox will change the source of data used for the auto suggestions provided by the OS as the user starts typing. For example in the screenshot above you can see the user is typing in a person's name yet the operating system is suggesting matching cellphone numbers.

GridView Code Suggestions



I have a gridview which displays data from a database.

Everything works fine, the thing is that I haven't come with a method to do the next thing:

The gridview displays something like this:

Client - Total - Percentage

Ex1      1000    20%

Ex2      2000    40%

Ex3      1000    20%

Ex4      500      10%

Ex5      500      10%

This data might vary depending on the month selected etc etc....

What I want to do is that the gridview kind of check its rows and start summing the percentaje, when it sums 80% I want to color the rows that sum the 80% to one specific color then the rest of the rows  leave them with the default color or change it too.

I'm thinking that I might be able to do that with the row data bound event, but I just can't find the answer to do it, I know how to iterate through the rows to sum the values but then how I can tell it to stop if it reaches 80% and color the rows that completed that 80%.

Another thing, the rows that complete this 80% of course have to be the ones with the greatest percentages. In the example above it would be Ex1, Ex2, Ex3. That 80% percent can

Autocomplete with multiple word suggestions, How can we do in Asp.Net with Ajax?


Hi All,

Could you please let me know the process to get multiple word suggesions for a text box in asp.net using Ajax.  

Actually I got a solution for that,


But it used Atlas. When I am running with this code in my application, it is conflicting with Script Manager that is already there in Masterpage.

How can I overcome that problem. Is there any built-in solution in latest versions of Ajax?


Thanks in Advance,

Sateesh Nagalla,



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend