all things Sitecore related

C#

Sending tokenized emails from a Sitecore Engagement Plan

Sending tokenized emails from a Sitecore Engagement Plan

An action that can be executed from within a Sitecore Engagement Plan is to send an email to a static or to the visitors email address. The action “Send E-Mail Message” does not process tokens which are added in the subject or to the body of the email. To be able to send emails where […]

Continue Reading »

Beware of deleting language items

By on December 9, 2013 in ASP.Net, C#, Sitecore, Tips and Tricks with 0 Comments
Beware of deleting language items

Not a very spectacular post but something I ran into recently and can really destroy your environment. Under /system/languages all installed and available sitecore languages are presented. Those items are based on the template /templates/System/Language. Normally editors are not allowed to see those items but sometimes they manage to get themselves admin rights and they […]

Continue Reading »

Implementing Search Operations in Sitecore 7

By on April 5, 2013 in C#, MVP, Sitecore, Sitecore 7 with 17 Comments
Implementing Search Operations in Sitecore 7

Sitecore 7 is buzzing! While unsure about the release data, MVP around the world are taking the deep dive. So here we go, diving in the new Sitecore version. Search Operations Performing an action on a collection of items, always was a weak point and much requested feature by customers. For pre-Sitecore 7 installations we designed macro’s […]

Continue Reading »

Coded field datasources in Sitecore

Coded field datasources in Sitecore

I was really thrilled to see that Sitecore 7 will support coded datsources. This is a feature we already implemented at our company in earlier sitecore versions (kudos for the idea for my colleague and fellow MVP Remco van Toor). Coded datasources are very powerful and are frequently used in our company. For example in […]

Continue Reading »

Daily Tip: Sitecore caching sliding and absolute

Daily Tip: Sitecore caching sliding and absolute

With the Sitecore API it’s very easy to add items to the cache. You van use Sitecore.Caching.Cache to do the necessary operations. To add something to the cache you can use several overloads. Most of the time you want to add an expiration to the cached data. You have two different overloads to do this. […]

Continue Reading »

Asp.Net: keyboard sort items

By on September 24, 2010 in ASP.Net, C#, Javascript with 0 Comments
Asp.Net: keyboard sort items

As proof of concept I wanted to sort images in a Grid by keyboard. The sort logic needed to be implemented on the server. My solution for this problem is a combination of Javascript and C#. First add following html to you .aspx. Notice that the body tag has runat=”server” and a ID. <body<strong> runat="server" […]

Continue Reading »

C#: Get Parent Control with Generics

By on April 27, 2010 in ASP.Net, C#, Controls with 0 Comments
C#: Get Parent Control with Generics

I use the following method to return a parent control of a specific type. This method is recursive and uses generics. <br /> private Control GetParentControl<T1>(Control control)<br /> {<br /> if (control.Parent.GetType() == typeof(T1))<br /> {<br /> return control.Parent;<br /> }<br /> else<br /> {<br /> return GetParentControl<T1>(control.Parent);<br /> }<br /> }</p> <p>

Continue Reading »

MemoryStream to Byte Array (Byte[])

By on April 19, 2010 in ASP.Net, C# with 0 Comments

With the following code you can convert your MemoryStream to a Byte Array. //create new Bite Array byte[] biteArray = new byte[memoryStream.Length]; //Set pointer to the beginning of the stream memoryStream.Position = 0; //Read the entire stream memoryStream.Read(biteArray, 0, (int)memoryStream.Length);

Continue Reading »

Create a Visual Studio add-in with contextmenu and selected text as input

By on February 25, 2010 in C#, Controls, Visual Studio with 0 Comments

Create a Visual Studio add-in with contextmenu and selected text as input When working with a new way of storing settings in a database. I was frustrated how much work it was to check the value of setting from code. So I deceided to make my life a bit easier by creating a VS2008 contextmenu […]

Continue Reading »

C#: Remove line from textfile

By on January 26, 2010 in ASP.Net, C#, linq with 0 Comments

With the following code you can remove a line from a textfile (web.config). If the string is within a line the line will be removed. string configFile = @"C:devweb.config"; List<string> lineList = File.ReadAllLines(configFile).ToList(); lineList = lineList.Where(x => x.IndexOf("<!–") <= 0).ToList(); File.WriteAllLines(configFile, lineList.ToArray());

Continue Reading »

Using fieldcontrols in a ListView

By on November 26, 2008 in ASP.Net, C#, Sitecore with 0 Comments

When you want to use a fieldcontrol like a Text, Link or Image control in a ListView you need to specify a datasource. By not specifying a datasource Sitecore looks at the current item. Which in a ListView is not the right one. So you need so set the datasource in code-behind or use an […]

Continue Reading »

Dynamic load where parameters for linqDatasource

By on April 21, 2008 in ASP.Net, C#, linq with 5 Comments

When using an Linq Datasource (linq to sql) for a datagrid (Gridview, ListView, etc) you don’t always want all rows from a table. To exclute data you can use the WhereParameters to add an where statement to your DataSource. You can do limited where statements with the Visual Studio Wizards. When you need more than a […]

Continue Reading »

Top