Tag Archives

Injecting Conditional HTML and Content Blocks with ASP.NET MVC Razor

I have been working recently with ASP.NET MVC 3 and the Razor view engine. For part of the work I’m doing, I need to send some content to the browser based upon certain conditions. I described a couple of ways to do this before in this post and this post and I wanted to share

Comments Off on Injecting Conditional HTML and Content Blocks with ASP.NET MVC Razor

Use the .NET HtmlString Class to Output Raw HTML

I posted recently about sending raw unencoded HTML to the client using the Html.Raw() method with MVC 3 and the Razor view engine. I wanted to extend a bit on that post regarding the magic underlying the Html.Raw() method, the HtmlString class in the System.Web namespace of the .NET framework class library. You can use the

Submit a Disabled HTML Form Field Value

By default, the HTML 4 specification does not allow disabled form control values to be submitted with other values in a form. Sometimes you want to submit the value from a disabled control like a text box, though, and here I demonstrate an approach to submitting a disabled form control value using a hidden form control.

MVC Razor Tip: Output Raw Unencoded HTML

I’m working on an MVC Razor project and need to output some raw HTML to disable an HTML text box if the text box is populated with a value. I realized, though, that my initial attempt didn’t render quite the output I expected. My original code to output the  disabled=”disabled” attribute (gotta love XHTML compliance!) was

CSS Tip for Relative Pathing with URIs

I’m working on a CSS style sheet and using the background-image property to set up an image in a header. I seem to forget from time to time how to correctly form a relative URL in CSS, especially when switching contexts back and forth between client- and server-side programming as well as moving in and

Handy WordPress Blog Tip: Display Source Code Markup with Syntax Highlighting

I’m relatively new to blog authoring in general and to using the WordPress platform for blogging in particular. The first few months of articles I’ve authored have included a number of source code references—PowerShell, C#, HTML, CSS and others—and I’ve put in source code using the Preformatted style. This works okay but I kept drooling

Comments Off on Handy WordPress Blog Tip: Display Source Code Markup with Syntax Highlighting
Sign in
classic
Forgot password?
×
Sign up

(*) Required fields

I agree with OptimaSales Terms & Privacy Policy

×