razor

Modding Motorola Razor

I want to know if there is a tool I can download enabling me to use my old Motorola Razor's original hardware to display anything I want (i.e. use it for a name tag). The phone is flashed for sprint. It wont get past a boot screen, so I need to re flash it. I just want a tool to make a simple program that can run off of the original hard...

Decoding HTML in ASP.NET MVC 3

@ in asp.net mvc 3 preview 1 automaticly encodes html, is there an alternative way to let there be html? think of this scenario: @view.BestSitesEver.Replace("stackoverflow", "<h1>StackOverflow</h1>") That would just print out: <h1>stackoverflow</h1> ...

Possible to add shortcut names to razor namespace imports in MVC 3 web.config

Similar to using Shortcut = System.Whatever; in the cshtml I have so far been out of luck doing something similar in the webconfig <pages> <namespaces> <add namespace="System.Web.Routing" as="Routing" /> </namespaces> </pages> Something like that...Is it possible at all? ...

Return Razor partial view using JSON (ASP MVC 3)

In MVC 2 with the regular view engine i could return a ascx partial view as string through return Json() But with the new Razor .cshtml views I can not figure out how to do this. I keep getting Type 'ASP.CustomerForm_cshtml' does not inherit from 'System.Web.UI.UserControl'. The partial view inherits from System.Web.Mvc.WebViewPage<T> ...

Enable client validation in Razor views (ASP MVC 3)

I try to add client side validation using this line of code: @Html.EnableClientValidation() But I keep getting this error message: Compiler Error Message: CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microsoft.WebPages.Helpers.HelperResult)' has some invalid arguments Is this working for ...

Razor syntax inside attributes of html elements (ASP MVC 3)

I have a table with repeating customer rows, I would like to add the customer ID to the ID attribute of my table rows like this: <tr id="row<customer id>"></tr> I try adding this code: @foreach(var c in Model) { <tr id="[email protected]"></tr> } Which gives me the following output: <tr id="[email protected]"></tr> <tr id="[email protected]"></tr> etc....

MVC 3 Preview 1 with Azure Development Environment

I am in the early stages of developing an Azure web project which will likely take more than six months to complete. The views which make up the UI would benefit from clean syntax provided by the Razor view engine found in the MVC 3 preview 1. The following exception is thrown whenever the site is run as an Azure web role: InvalidOpe...

Webmatrix and Stored Procedures

I'm fooling around with WebMatrix, and so far the best way I've figured out how to use stored procedures with Razor/WebMatrix is like so- @if (IsPost) { var LinkName = Request["LinkName"]; var LinkURL = Request["LinkURL"]; string sQ = String.Format("execute dbo.myprocname @LinkName=\"{0}\", @LinkURL=\"{1}",LinkName, LinkURL); d...

ASP.NET MVC Razor syntax

Here is what I would like to express by Razor: <b>@parameterMapping.Title</b> (Category: @parameterMapping.Category.Title, Regexp: @parameterMapping.Regexp) But to make it parseable I have to write it this way: <b>@parameterMapping.Title</b> <text>(Category: </text> @parameterMapping.Category.Title <text>, Regexp:</text> @parameterMa...

ASP.NET MVC Razor Roadmap

I've been searching around on the Goog, but because technology moves so quickly, all my results are seemingly obsolete (brushing the dust off). I'm looking for the Razor Roadmap for MVC. I know it went preview, but I'm wondering about the full blown release. I really want to start using Razor, but I'm not sure what the implications wo...

Is there a better way to specify default section content in asp.net mvc razor layouts?

With the asp.net mvc web form engine, you could define a content placeholder and specify the default content. How is this done with Razor engine? This is the only way I found - but it seems like there would be a better way. _Layout.cshtml: @if (IsSectionDefined("Footer")) { @RenderSection("Footer") } else { <text>Default fo...

How to concisely create optional HTML attributes with razor view engine?

I'm looking for a way to write the following code with less lines of code (maybe 5). I suppose I could do the same thing as the selected class but this razor syntax isn't looking pretty. <ul> @foreach (var mi in Model.MenuItems) { <li@(mi.Selected?" class=\"selected\"":null)> @if (string.IsNullOrEmpty(mi.Title)) { <a href="@mi....

Using the Razor view engine in a different way.

I thought it would be interesting if I could use the new MVC Razor View engine as a mail merge technology. It can still be part of an MVC website and does not have to be stand-alone console app. Example: string myTemplate = "Hello @Name, How are you today?"; ViewModel.Name = "Billy Boy"; string output = RazorViewEngineRender( myTemp...

ASP.NET MVC 3 Razor performance

I've made a simple hello world project in asp.net mvc2,3 aspx and 3 razor and benchmarked them. What I see is: asp.net mvc 2 aspx : 4200 request per second asp.net mvc 3 aspx : 3200 request per second asp.net mvc 3 razor : 1700 request per second What's wrong with razor, it's so slow? Update: I've redone the test. All 4 test virtual...

Nested operations with Razor View Engine

I cannot figure out how to do "nested" operation in Razor. For example how to use IF inside FOREACH. VisualStudio throws compile-time error on following block, saying "Invalid expression term 'if' " @foreach (var document in Model) { @if (document.Item.Count > 0) { <div> @MvcHtmlString.Create(document.Items[0].C...

Razor syntax @using and namespace declarations fail

Is there some sort of magic I need to use to get the namespaces in the pages/namespaces element in the webconfig? <pages> <namespaces> <add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc.Ajax"/> <add namespace="System.Web.Mvc.Html"/> <add namespace="System.Web.Routing"/> <add name...

Upgraded to MVC3 Beta, Razor views generate a different base class than a newly created project

I have been working on a website using MVC Preview 1 since it came out. Now that beta is out, I have updated my system to beta. There is not alot of help out there for upgrading from Preview 1 to beta, and just rebuilding caused a lot of problems. What I have done so far: 1) Copied the web.config from a new MVC3 Beta project (to get ...

Cannot Get RazorView from Windsor Container using MVC 3 Beta

Hi, This is how my Application_Start looks: protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); _container.Register(Component.For<IWindsorContainer>() .Instance(_container), ...

Visual Studio 2010 doesn't set .CSHTML (Razor View Engine) as Content

Hi! I've been trying to deploy my ASP.NET MVC 3 Beta Application to my hosting. It supports all the necessary technologies and through trail and error I set the needed references' Copy Local to True. Then I got the error that my app cannot find the view. It listed .cshtml files it tried. I had those files in my project but they weren't ...

Iron Python vs Razor

Hello folks, I have a little bit of experience with the new Razor syntax, but none with Iron Python. I was wondering do both meet the same needs? Is one favored by Microsoft over the other (or will be)? Appreciate your thoughts, as I'm toying with the idea of learning Iron Python, but if Razor can meet the same need, I probably won't....