Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Steve McNiven-Scott sitefinitysteve

🏠
Working from home
View GitHub Profile
View HandlerCSharp.cs
[HttpPost]
public ActionResult UploadFile(HttpPostedFileBase file, string returnUrl)
{
if (file == null)
{
TempData["UploadError"] = "File Error";
return RedirectPermanent(returnUrl);
}
try
View Sitemap_Urls_Global.asax.cs
using System;
using System.Linq;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.SitemapGenerator.Abstractions.Events;
using Telerik.Sitefinity.SitemapGenerator.Data;
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
@sitefinitysteve
sitefinitysteve / 1-tailwindbreaks.html
Last active May 13, 2021
Tailwind responsive breakpoint viewer
View 1-tailwindbreaks.html
<!-- TAILWIND CSS RESPONSIVE SIZE -->
<span class="text-xs text-gray-200 tailwind-breaks">
<span class="inline-block sm:hidden">XS</span>
<span class="hidden sm:inline-block md:hidden">SM</span>
<span class="hidden md:inline-block lg:hidden">MD</span>
<span class="hidden lg:inline-block xl:hidden">LG</span>
<span class="hidden xl:inline-block">XL</span>
</span>
@sitefinitysteve
sitefinitysteve / SearchAllTables.sql
Created Jul 24, 2020
/blog/code/2012/03/16/the-best-stored-procedure-youll-ever-use-for-sitefinity
View SearchAllTables.sql
CREATE PROC SearchAllTables]
(
@SearchStr nvarchar(100)
)
AS
BEGIN
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
@sitefinitysteve
sitefinitysteve / TelerikReportingNeedsDataSource.cs
Created Jul 24, 2020
/blog/code/2012/03/16/telerik-reporting-needsdatasource
View TelerikReportingNeedsDataSource.cs
private void crosstab1_NeedDataSource(object sender, EventArgs e) {
Telerik.Reporting.Processing.Table procReport = (Telerik.Reporting.Processing.Table)sender;
List<Response> submissions = (from s in context.Responses
where s.Submission.FormID == new Guid("6F38E890-6FFE-4F50-A8B5-8C5FDADDAF31")
select s).ToList();
var formatted = (from s in submissions
select new {
Submission = s.Submission,
@sitefinitysteve
sitefinitysteve / TelerikReportingExportToPdf.cs
Created Jul 24, 2020
/blog/code/2012/03/16/telerik-reporting--export-on-button-click
View TelerikReportingExportToPdf.cs
void ExportToPDF(Telerik.Reporting.Report reportToExport)
{
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, null);
string fileName = result.DocumentName + ".pdf";
Response.Clear();
Response.ContentType = result.MimeType;
Response.Cache.SetCacheability(HttpCacheability.Private);
@sitefinitysteve
sitefinitysteve / getwf4bookmarks.sql
Created Jul 24, 2020
/blog/code/2012/03/16/stored-procedure-for-obtaining-wf4-bookmarks
View getwf4bookmarks.sql
-- =============================================
-- Author: Steve
-- Create date: Auguest 2, 2010
-- Description: Converts the Pending Bookmarks into rows
-- =============================================
CREATE PROCEDURE [dbo].[workflow_Get_Bookmarks]
@instanceID uniqueidentifier = NULL
AS
BEGIN
SET NOCOUNT ON;
@sitefinitysteve
sitefinitysteve / web.config
Last active Jul 23, 2020
Sitefinity Assembly Binding example
View web.config
<!-- https://www.sitefinitysteve.com/blog/code/2012/03/25/avoid-version-errors-with-assembly-binding -->
<?xml version="1.0" encoding="UTF-8"?>
<runtime>
<!-- So this binds everything to 12.2.7100.1 as an example -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="12.2.7100.1" />
</dependentAssembly>
<dependentAssembly>
View openFacebookApp.js
import { available } from "nativescript-appavailability";
import { isAndroid, isIOS, device, screen } from "tns-core-modules/platform";
import * as utils from "tns-core-modules/utils/utils";
export function onOpenLink(args){
let link: LinkItem = args.view.bindingContext;
if (link.domain == "facebook.com") {
//FACEBOOK APP
const fbScheme = isIOS ? "fb://" : "com.facebook.katana";
@sitefinitysteve
sitefinitysteve / Write.Default.cshtml
Last active Oct 30, 2019
EmailTextField Write.Default.cshtml - Autofill user
View Write.Default.cshtml
@model Telerik.Sitefinity.Frontend.Forms.Mvc.Models.Fields.EmailTextField.EmailTextFieldViewModel
@using Telerik.Sitefinity.UI.MVC;
@using Telerik.Sitefinity.Frontend.Forms.Mvc.Helpers;
@using Telerik.Sitefinity.Frontend.Mvc.Helpers;
@using Telerik.Sitefinity.Modules.Pages;
@using global::Medportal.Sitefinity.Controls;
@using Telerik.Sitefinity.Services;
@using Telerik.Sitefinity.Localization;
@using Telerik.Sitefinity.Frontend.Forms.Mvc.StringResources