Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Steve McNiven-Scott sitefinitysteve

🏠
Working from home
Block or report user

Report or block sitefinitysteve

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 Sitefinity Rename Forms Database Table
-- the old name of the form
declare @oldName nvarchar(30) = 'sf_table_name';
-- the new name of the form
declare @newName nvarchar(30) = 'sf_table_name';
-- rename the table with form entries
exec sp_rename @oldName, @newName;
-- change the form name in the forms description
update [sf_form_description]
@sitefinitysteve
sitefinitysteve / CollectionExtensions.cs
Last active Jul 5, 2019
SitefinitySteve Extension Collection, included in the RandomSiteControls
View CollectionExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Telerik.Sitefinity
{
public static class CollectionExtensions
{
/// <summary>
@sitefinitysteve
sitefinitysteve / Samples.aspx
Last active Dec 19, 2015
Sitefinity Template Layout Helpers. Use these in a RadListView to generate you dynamic layout wrappers around your content.
View Samples.aspx
<!-- Regular Sample -->
<telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
<LayoutTemplate>
<div class="sf_cols">
<asp:PlaceHolder ID="ItemsContainer" runat="server" />
</div>
</LayoutTemplate>
<ItemTemplate>
<div class='<%# Util.Out(Container) %>'>
<div class='<%# Util.In(Container) %>'>
@sitefinitysteve
sitefinitysteve / SitefinityLayoutSamples.html
Created Jul 1, 2013
Sitefinity Layout Control Samples
View SitefinityLayoutSamples.html
<!-- 2 col sample -->
<div class="sf_cols">
<div class="sf_colsOut sf_2cols_1_50">
<div class="sf_colsIn sf_2cols_1in_50">
</div>
</div>
<div class="sf_colsOut sf_2cols_2_50">
<div class="sf_colsIn sf_2cols_2in_50">
@sitefinitysteve
sitefinitysteve / SimpleImage
Created Jul 31, 2013
Replacement for the sitefinity image asset field control, allows you to set a microdata attribute as well (among other things)
View SimpleImage
using System;
using System.Linq;
using System.Web;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.DynamicModules.Model;
using System.Web.UI;
using Telerik.Sitefinity.Model;
using Telerik.Sitefinity.Model.ContentLinks;
using Telerik.Sitefinity.Modules.Libraries;
using Telerik.Sitefinity.SitefinityExceptions;
View Global.asax.cs
using System;
using System.Linq;
using Telerik.Sitefinity.Services;
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
@sitefinitysteve
sitefinitysteve / RadDocumentPdfDownload
Last active Aug 29, 2015
Sitefinity RadDocument PDF Export Sample
View RadDocumentPdfDownload
protected void OnDownloadPDF_Click(object sender, EventArgs e) {
string output = "";
byte[] buffer = new byte[0];
string filename = "file"
string html = Util.GetHtmlToExport(); //However you want...this is a fake stub
var thread = new Thread(() =>
{
Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider provider = new Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider();
View Sitefinity Rewrite Rules.xml
<rule name="Default Document" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^\/home$" />
<add input="{REQUEST_URI}" pattern="^\/default.aspx$" />
</conditions>
<action type="Redirect" url="/" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="RedirectToWWW" enabled="true" stopProcessing="true">
<match url=".*" />
@sitefinitysteve
sitefinitysteve / gist:9d22b8ea8e0856e5f465
Created Nov 11, 2014
Application_Error to handle document passthrough
View gist:9d22b8ea8e0856e5f465
protected void Application_Error()
{
//Sitefinity Logger should send to raygun now
var exception = Server.GetLastError();
//Send document requests over to login
if(exception.Message.Contains("You are not authorized to 'View document'") || exception.Message.Contains("You are not authorized to 'View image'")){
if (!ClaimsManager.GetCurrentIdentity().IsAuthenticated)
{
//If user is anonymous, send them to the login
@sitefinitysteve
sitefinitysteve / Download.aspx
Created Nov 11, 2014
Download.aspx Document Download
View Download.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Download.aspx.cs" Inherits="SitefinityWebApp.Download" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
var max_time = 5;
var cinterval;
You can’t perform that action at this time.