all things Sitecore related

ASP.Net

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 »

Design Patterns(C#): Basic example Strategy pattern

Design Patterns(C#): Basic example Strategy pattern

In this example I´m going to explane the strategy pattern. With this example you can do a calculation with two numbers (-/+) and expand the number of operators (/, *, etc.). First create a interface which defines the interface of the operator classes. For this example an operator can only calculate two values. //The interface […]

Continue Reading »

Asp.Net: Webtest trough proxy (WebTestPlugin)

By on October 24, 2010 in ASP.Net, Microsoft, Visual Studio with 0 Comments

The test-team came to me with a problem involving connection errors while running webtests trough the company proxy. The webrequest needed to go to the webproxy including authentication. Visual Studion 2008 doesn’t support proxy authentication out of the box, but you can create a WebTestPlugin that does the authentication for every request. The following class […]

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 »

Asp.Net: DataPager problem with Listview

By on December 23, 2009 in ASP.Net, Controls with 2 Comments

When using the Datapager with a ListView I had the following problem. When clicking a paging button for the first time nothing happens.But when I click a button the second time, then the page from the first click loads. I search the internet for a solution and found that you need to add some code to […]

Continue Reading »

TypeMock: Mock Unittest examples

By on October 21, 2009 in ASP.Net with 0 Comments

In this example I will show how to create a Unit Test with TypeMock. First I have created some basic dummy classes for the example public sealed class ServiceFactory {     public static ExpireDateService CreateExpireDateService()     {         ExpireDateService expireDateService = new ExpireDateService();         expireDateService.administration = new SqlAdministration("connectionstring");         return expireDateService;     } } /// […]

Continue Reading »

Asp.net: DateTime Eval String formatting

By on September 24, 2009 in ASP.Net with 0 Comments

With the following code you can format a DateTime within a Databind. <%# DateTime.Parse(Eval("DateModified").ToString()).ToString("MM-dd-yyyy")%> 

Continue Reading »

Top