Skip to content

Instantly share code, notes, and snippets.

@pgregorynz
pgregorynz / alternative for creating file input types in MVC views
Created May 28, 2013 12:15
Because MVC doesnt have an EditorFor input types of files this little trick lets you get around that rather than having to hardcode your input. You change the type of the texbox to be of type file.
@* the model property for Upload is of type HttpPostedFileBase *@
@* rather than doing having to hardcode <input type="file" name="upload" id="upload" /> *@
@Html.TextBoxFor(model => model.Upload, new{type="file"})
@pgregorynz
pgregorynz / IContentFinder example
Created October 23, 2013 06:34
Using IContentFinder to get content outside of the main content tree in Umbraco 6.1 to replicate the behavior of the pipeline in v4 that allowed you to view content outside the main content tree by its assigned URL. Based on the Gist by Lee K.
using Umbraco.Core;
using Umbraco.Web.Routing;
namespace Website.ContentHelper
{
public class ContentFinder : ApplicationEventHandler
{
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByNotFoundHandlers, ContentFinderCommonPages>();
@pgregorynz
pgregorynz / previewbadge.xml
Last active August 29, 2015 14:08
A better Umbraco Preview Mode Indicator
<!--
replace the previewBadge element in the umbracosettings.config
This will give you a green fixed banner across the bottom of the screen.
It adds 50px to the bottom of page to ensure the banner
doesnt mess with your design. It also has a high z-index so it will work properly in most situations.
-->
<PreviewBadge><![CDATA[
<div style="width:100%; height:50px;">
<a id="umbracoPreviewBadge" style="position: fixed; z-index:1000; width:100%; background: #00cc00; bottom:0;left:0;padding:15px" href="{0}/endPreview.aspx?redir={2}">