Eliminate duplication in CSS with .less – a .NET HTTP handler

 

One of the frustrating aspects of working with CSS (one of many, actually) is the amount of duplication in a .css file. .less help to keep your CSS files DRY using 4 constructs:

  • Variables
  • Mixins
  • Operations
  • Nested Rules

image

An HTTP handler is configured to respond to requests for the .less files.

<httpHandlers>
    <add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*"/>
</httpHandlers>

When a request arrives for a .less file it is the handler’s job to parse the .less file and transform it into standard CSS rule sets.

What’s new in ASP.NET 4 – Short Videos

 

#1 | ASP.NET 4 "Quick Hit" – Chart Control 2 minutes, 42 seconds

#2 | ASP.NET 4 "Quick Hit" – Dynamic Metadata 5 minutes, 37 seconds

#3 | ASP.NET 4 "Quick Hit" – Permanent Redirect 5 minutes, 35 seconds

#4 | ASP.NET 4 "Quick Hit" – Imperative WebForms Routing 12 minutes, 39 seconds

#5 | ASP.NET 4 "Quick Hit" – Declarative WebForms Routing 14 minutes, 16 seconds

#6 | ASP.NET 4 "Quick Hit" – Outbound WebForms Routing 6 minutes, 18 seconds

#7 | ASP.NET 4 "Quick Hit" – Auto Start 11 minutes, 38 seconds

#8 | ASP.NET 4 "Quick Hit" – Clean Web.Config Files 2 minutes, 41 seconds

#9 | ASP.NET 4 "Quick Hit" – Predictable Client IDs 10 minutes, 47 seconds

#10 | ASP.NET 4 "Quick Hit" – Selective View State 6 minutes, 40 seconds

#11 | ASP.NET 4 "Quick Hit" – The HtmlEncoder Utility Method 5 minutes, 8 seconds

Via ASPNET 4 : The Official Microsoft ASP.NET Site

MVC or Web Forms? A Dying Question

 

Everyone who talks about ASP.NET MVC gets asked the question:

    Should I use MVC or Web Forms?

There’s been quite a bit of debate on this topic, but in a couple years I don’t think it will matter.

twin cars

and the stories continues here MVC or Web Forms? A Dying Question until …

spectrum

The question in the next decade won’t be: “MVC or Web Forms?”.

The question will be: “MVC or SharePoint?

But nobody will ask the question, because the answer is easier to figure out.

:>

AsynFileUpload – from AJAX Control Toolkit

 image

AsynFileUpload Control

The second new control included in the newest release of the AJAX Control Toolkit is the AsyncFileUpload control. You can use this control to display a fancier interface for uploading files. The AsyncFileUpload control:

  • Enables you to perform file uploads without doing a postback
  • Displays a throbber images while an image is being uploaded
  • Raises both server and client events when a file upload completes or when there is an error.
  • Works inside and outside of an UpdatePanel

Admit it! The standard file upload widget that you get with HTML is boring. You can’t display a picture while a file is uploading. And, it forces you to do a postback which is bad in this new Ajax world.

<asp:UpdatePanel ID="up1" runat="server">  
  <ContentTemplate>  
    <h1>Add File</h1>  
    File: <br />  
    <cc1:AsyncFileUpload ID="AsyncFileUpload1" onuploadedcomplete="AsyncFileUpload1_UploadedComplete" runat="server" />  
    <br /><br />  
    Description:<br />  
    <asp:TextBox ID="txtDescription" runat="server" />  
    <br /><br />  
    <asp:Button ID="btnSubmit" Text="Add File" runat="server" />  
    </ContentTemplate>  
</asp:UpdatePanel>  
public partial class TestAsnycFileUpload : System.Web.UI.Page  
{  
    protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)  
    {  
        System.Threading.Thread.Sleep(5000);  
        string savePath = MapPath("~/Uploads/") + Path.GetFileName(e.filename);  
        AsyncFileUpload1.SaveAs(savePath);  
    }  
}
  

Via New AJAX Control Toolkit Release

A better solution to find ASP.NET ClientIDs with jQuery

 

A small routine that returns us a jQuery object based on only the id:

function $$(id, context) {
    var el = $(&quot;#&quot; + id, context);
    if (el.length &lt; 1)
        el = $(&quot;[id$=_&quot; + id + &quot;]&quot;, context);
    return el;
}

So in simple usage to select my ctl00_MainContent_txtSymbol value both of the following work:

alert( $$(&quot;txtSymbol&quot;).attr(&quot;id&quot;) );

Or if I want to be specific about the container:

alert( $$(&quot;txtSymbol&quot;,$(&quot;#wrapper&quot;)).attr(&quot;id&quot;) );

Via A generic way to find ASP.NET ClientIDs with jQuery – Rick Strahl’s Web Log

Facebook Developer Toolkit 3.0 – ASP.NET MVC Sample

 

Facebook Developer Toolkit 3.0 – ASP.NET MVC Sample

It’s almost time for the long awaited release of the Facebook Developer Toolkit 3.0, the most awesomest release of the toolkit to date. The new version has great support for ASP.NET, ASP.NET MVC, Silverlight, WinForms, WPF and basically any place you can run .NET.

image

Facebook Developer Toolkit 3.0 – ASP.NET MVC Sample – Kevin Marshall’s Epic Work Blog for Awesome People