Skip to content

Instantly share code, notes, and snippets.

avisra

Block or report user

Report or block avisra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MvcControllerProxyNoCache.cs
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Web;
using System.Web.UI;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Mvc;
using Telerik.Sitefinity.Mvc.Proxy;
using Telerik.Sitefinity.Services;
@avisra
avisra / CustomPageRouteHandler.cs
Last active Aug 18, 2016
Custom page route handler for improved OutputCache
View CustomPageRouteHandler.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Web;
using Telerik.Microsoft.Practices.Unity;
using System.Collections.Specialized;
namespace SitefinityWebApp
@avisra
avisra / Global.asax.cs
Created Apr 13, 2013
This snippet allows you to redirect users to a specific page when they try to access a page they are not authorized to access.
View Global.asax.cs
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
Bootstrapper.Initialized += new EventHandler<ExecutedEventArgs>(Bootstrapper_Initialized);
}
protected void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
@avisra
avisra / DynamicTypes.cs
Created Apr 13, 2013
This snippet demonstrates how to extend one of Sitefinity's classes (like Discount) to support dynamic fields.
View DynamicTypes.cs
// If this class is not already setup as a dynamic meta type - set it up. Without this, you cannot add custom fields to the type
if (metaManager.GetMetaType(typeof(Discount)) == null)
{
metaManager.CreateMetaType(typeof(Discount));
metaManager.SaveChanges();
}
// The snippet below allows you to create a new property/field of the specified type (Discount). The benefit to this is that Sitefinity will actually create a new column for "Uses" and this can be saved/read using Sitefinity's functions: discountObject.GetValue<decimal>("Uses") and discountObject.SetValue("Uses", 1)
App.WorkWith()
@avisra
avisra / CustomFormsControl.cs
Created Apr 13, 2013
Sitefinity's Form Builder allows users to create forms on the fly. This code snippet is for overriding the default control for Form Builder forms. This allows you to attach to the save event of the form so that you can process data when the form is submitted. This works well for instances where you need to capture lead data for sending to a CRM.
View CustomFormsControl.cs
public class CustomFormsControl : FormsControl
{
protected override void InitializeControls(GenericContainer container)
{
base.InitializeControls(container);
// Attaches to the FormSaved event to run custom code upon submitting a Form Builder form.
this.FormSaved += new EventHandler<System.EventArgs>(CustomFormsControl_FormSaved);
}
You can’t perform that action at this time.