Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
RyanABailey / C#
Created May 21, 2015 01:09
Sitecore Search Implementation
public partial class SearchResults : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
var searchQuery = Request.QueryString["s"]; // search query
var searchResults = new List<SearchResult>();
if (!string.IsNullOrEmpty(searchQuery))
{
// sitecore search index
@RyanABailey
RyanABailey / c#
Last active August 29, 2015 14:21
LINQ Regex
var testList = new [] {"You may concatenate a string.", "They have a cat.", "Cat is a feline.", "Her name is Catherine."};
var regex = new Regex(@"(^|\W)cat", RegexOptions.IgnoreCase | RegexOptions.Multiline);
var matches = testList.Where (l => rexex.IsMatch(l));
@RyanABailey
RyanABailey / MainLayout
Last active August 29, 2015 14:22
Layout
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainLayout.aspx.cs" Inherits="MySitecoreSite.Layouts.MainLayout" %>
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@RyanABailey
RyanABailey / aspx
Created May 28, 2015 05:28
Sublayout
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MainContent.ascx.cs" Inherits="MySitecoreSite.Sublayouts.MainContent" %>
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<div>
<sc:Text Field="Content" runat="server" />
</div>
@RyanABailey
RyanABailey / aspx
Created May 28, 2015 05:36
DestinationContent
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DestinationContent.ascx.cs" Inherits="MySitecoreSite.Sublayouts.DestinationContent" %>
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<h2><sc:Text Field="Name" runat="server" /></h2>
<div>
<sc:Text Field="Description" runat="server" />
</div>
@RyanABailey
RyanABailey / aspx
Last active May 24, 2016 03:47
Navigation
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Navigation.ascx.cs" Inherits="MySitecoreSite.Sublayouts.Navigation" %>
<ul class="nav navbar-nav navbar-right">
<asp:Repeater ID="rptMenu" runat="server">
<itemtemplate>
<li>
<a href="<%# Eval("Link") %>"><%# Eval("Text") %></a>
</li>
</itemtemplate>
</asp:Repeater>
@RyanABailey
RyanABailey / CSS
Created June 23, 2015 00:34
Modal CSS
@media print {
body * {
visibility:hidden;
}
.printable, .printable * {
visibility:visible;
}
.printable {
position:absolute;
left:0;
@RyanABailey
RyanABailey / CSS
Created June 23, 2015 00:34
Modal CSS
@media print {
body * {
visibility:hidden;
}
.printable, .printable * {
visibility:visible;
}
.printable {
position:absolute;
left:0;
@RyanABailey
RyanABailey / class
Created June 26, 2015 06:42
Ektron rich text
public partial class rich {
private System.Xml.XmlNode[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlNode[] Any {
get {
return this.anyField;
@RyanABailey
RyanABailey / After
Created June 27, 2015 15:55
Smartform class
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", ElementName = "root", IsNullable = false)]
public partial class News {