Kentico CMS Code Snippet Library - what additional snippets do you want?
As I start to get ready for my the upcoming Kentico Connections conference I was looking at the various code and samples that I have been collecting over the last year. It made me realize that there was a lot of code! One of my favorite features in Visual Studio is Code Snippets.
I decided to start a Kentico CMS Code Snippet Library. I want to use it as a way of distributing my snippets and hopefully get feedback from people on what they would like to see. For the start I have included five code snippets
1. Get the users current site
2. Get the users information
3. Add a web part container
4. Add a CMS Repeater
5. Add a new user
What other ones would you like to see?
How do I use it?
The library is available here for download. I am using the community content installation (.vsi). This should make installation and sharing a lot easier.
1. Download the Kentico_Snippet.vsi file onto your local machine and double click it
2. Make sure the snippet files are selected and then click Next as shown below
3. You will receive a signature error that you need to select Yes as shown below
Note: I will get this signed
4. Select the locations for the snippets on your machine and then select Next. You can do this for each snippet.
Note: there are two types of snippets included -HTML and C#
5. Select Finish to copy the files on your machine
6. Complete the installation as shown below
With the installation complete. Open your Web project and you can use the snippets with the following steps
C# Code Snippet
1. Open the code behind of a page and right click and select Insert Snippet as shown below
2. Select the snippet as shown below
3. The snippet is added as shown below
HTML Code Snippet -
1. Open the HTML of a page as shown below and right click and select Insert Snippet as shown below
2. Select the HTML Snippet as shown below
3. The snippet is added as shown below