Skip to content

Instantly share code, notes, and snippets.

View grumpycatsaysno's full-sized avatar
:octocat:
coding in the deep

Veronica Milcheva grumpycatsaysno

:octocat:
coding in the deep
View GitHub Profile
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustomTemplate.ascx
Last active February 9, 2016 11:59
Taxonomy Control Template
<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<sf:SitefinityLabel id="titleLabel" runat="server" WrapperTagName="h2" HideIfNoText="true" CssClass="sftaxonTitle" />
<sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
<Templates>
<sf:ConditionalTemplate ID="ConditionalTemplate1" Left="RenderAs" Operator="Equal" Right="HorizontalList" runat="server">
<asp:Repeater ID="repeater_horizontallist" runat="server">
<HeaderTemplate>
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active February 9, 2016 12:03
RadListView control reference from the template
protected virtual RadTreeView TreeViewHierarchicalList
{
get
{
return this.Container.GetControl<RadTreeView>("treeview_hierarchicallist", false);
}
}
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active February 9, 2016 12:04
RenderTaxonomyAs enumerator
public new enum RenderTaxonomyAs
{
HorizontalList = 0,
VerticalList = 1,
Cloud = 2,
HierarchicalList = 3
}
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active February 9, 2016 12:08
TaxaRepeater reference
protected override Repeater TaxaRepeater
{
get
{
string lower = this.RenderAs.ToString().ToLower();
string str = string.Concat("repeater_", lower);
return this.Container.GetControl<Repeater>(str, false);
}
}
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active February 9, 2016 12:19
InitializeTaxaList method
protected override void InitializeTaxaList()
{
if (this.RenderAs == RenderTaxonomyAs.HierarchicalList)
{
IDictionary<ITaxon, uint> taxaItemsCountForTaxonomy = null;
if (this.ContentId == Guid.Empty)
{
taxaItemsCountForTaxonomy = this.GetTaxaItemsCountForTaxonomy();
}
else
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active February 9, 2016 12:23
ConfigureTreeViewHierarchicalListControl method
private void ConfigureTreeViewHierarchicalListControl(List<CustomTaxonData> taxonDatas)
{
this.TreeViewHierarchicalList.Skin = "BlackMetroTouch";
this.TreeViewHierarchicalList.ExpandAnimation.Type = AnimationType.InQuart;
this.TreeViewHierarchicalList.ExpandAnimation.Duration = 300;
this.TreeViewHierarchicalList.CollapseAnimation.Type = AnimationType.InQuart;
this.TreeViewHierarchicalList.CollapseAnimation.Duration = 200;
this.TreeViewHierarchicalList.DataSource = taxonDatas;
this.TreeViewHierarchicalList.DataFieldID = "TaxonId";
this.TreeViewHierarchicalList.DataFieldParentID = "ParentTaxonId";
@grumpycatsaysno
grumpycatsaysno / TaxonData.cs
Last active January 28, 2016 08:21
TaxonData class
protected internal class TaxonData
{
public uint Count { get; set;}
public int Size { get; set; }
public string Title { get; set; }
public string Url { get; set; }
public TaxonData()
{
}
@grumpycatsaysno
grumpycatsaysno / TaxonomyControlCustom.cs
Last active January 28, 2016 08:17
CustomTaxonData class
protected internal class CustomTaxonData
{
public Guid TaxonId { get; set; }
public Guid? ParentTaxonId { get; set; }
public uint Count { get; set;}
public int Size { get; set; }
public string Title { get; set; }
public string Url { get; set; }
private List<CustomTaxonData> CustomPrepareData(IDictionary<ITaxon, uint> taxaCount)
{
double num;
if (taxaCount.Count == 0)
{
return new List<CustomTaxonData>();
}
List<double> list = (
from pair in taxaCount
select pair.Value into t
@grumpycatsaysno
grumpycatsaysno / RadTreeView.css
Created February 9, 2016 12:28
Custom css styles for taxonomy treeview
<style type="text/css">
.sfPublicWrapper {
background-color: #734848;
}
div.RadTreeView .rtMinus,
div.RadTreeView .rtPlus {
display: inline-block !important;
}