CSS Sprites come to .NET WebForms/MVC

CSS Sprites come to .NET WebForms/MVC

By |March 16th, 2011|Coding, Uncategorized|0 Comments

Understanding ASP.NET server side tags

ASP.NET has a numerous server side tag syntax, here is my attempt to explain them all:

This is your basic tag for including server side code on a webform or view (MVC).

     string testVar = “Hello”;
     if (testVar == “Hello”)
          //do stuff

This is the equivalent of Response.write, this tag has been around since the classic asp days.
<%= Request.QueryString(“Variable”) %>

Used for outputting databound data via Eval and other databinding methods.
<asp:DataList ID=”dlPhotos” runat=”server”>
          <%# Eval(“Filename”) %>

Server side commenting, comparable to <!— —> in HTML.
<%— <asp:Literal ID=”lcName” runat=”server” /> —%>

Used for directive statements, usually found atop your page.
<%@ Import Namespace=”My.Namespace” %>

Very similar to <%= but performs an HTML encode on the data.
<%: Html.Image(“~/images/test.png”) %>

By |January 13th, 2011|Coding, Uncategorized|0 Comments