Sitefinity Dev Blogs Sitefinity Dev Blogs http://www.sitefinity.com/blogs.aspx http://backend.userland.com/rss Now Available in the Sitefinity Marketplace <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Sitefinity Marketplace Plug-ins" border="0" alt="Sitefinity Marketplace Plug-ins" align="right" src="http://www.sitefinity.com/Libraries/MetaBlogLib/WindowsLiveWriter-NewItemsintheSitefinityMarketplace_CBD5-bgAbout_3.sflb.ashx" width="130" height="112" />I’m happy to announce that the Sitefinity community has been very active lately creating new items for Sitefinity’s Marketplace. </p> <p>Several new items have recently been posted to <a href="http://www.sitefinity.com/marketplace.aspx">Sitefinity’s Marketplace</a>.&#160; </p> <h2>Events Map Plugin</h2> <p><strong><a href="http://www.sitefinity.com/marketplace/modules/events-map-plugin.aspx">Events Map</a></strong> is a plug-in that displays events on a global map via Google Maps. It produces the map with pins of all the events you have available on your website. A click of the pin will open a billboard-type section on the map with the event details with a link to the event page.</p> <p><em>Created by </em><a href="http://blog.basememara.com/"><em>Basem Emara</em></a><em>.</em></p> <h2>Events Rotator Plugin</h2> <p><strong><a href="http://www.sitefinity.com/marketplace/modules/events-rotator-plugin.aspx">Events Rotator</a></strong> is a plug-in that displays events in a rotator fashion anywhere on your site. It slides through all the events you have available on your website and displays a nicely formatted thumbnail, title, and time of the event. A click of the slideshow will take you to the full event page</p> <p><em>Created by </em><a href="http://blog.basememara.com/"><em>Basem Emara</em></a><em>.</em></p> <h2>Falafel Newsletter Group Importer</h2> <p>With the <strong><a href="http://www.sitefinity.com/marketplace/modules/falafel-newsletter-group-importer.aspx">Falafel Newsletter Group Importer</a></strong> you'll be ready to click the send button in a matter of seconds! Easily load all of your customer names and email addresses from a simple comma separated file (csv) directly into Sitefinity with this bulletproof wizard.</p> <p><em>Created by </em><a href="http://www.falafel.com/"><em>Falafel Software Inc.</em></a></p> <h2>FormBuilder Module</h2> <p>The <a href="http://www.sitefinity.com/marketplace/modules/formbuilder-module.aspx"><strong>FormBuilder</strong></a> is a module-based plug-in that allows non-technical administrators to create unlimited forms from their control panel</p> <p><em>Created by </em><a href="http://blog.basememara.com/"><em>Basem Emara</em></a><em>.</em></p> <h2>Google Static Map Control</h2> <p>The <strong><a href="http://www.sitefinity.com/marketplace/modules/google-static-map-control.aspx">Google Static Map</a></strong> control generates a map image using the latest Google Static Maps API. The map is centered on the address of your choice, with or without a marker.&#160; A &quot;click map for directions&quot; link can be enabled.&#160; </p> <p><em>Created by </em><a href="http://demo.datauniversalinc.com/Home.aspx"><em>Data Universal Inc</em></a><em>. </em></p> <h2>News Rotator Plugin</h2> <p><strong><a href="http://www.sitefinity.com/marketplace/modules/news-rotator-plugin.aspx">News Rotator</a></strong> is a plug-in that displays news in a rotator fashion anywhere on your site. It slides through all the news you have available on your website and displays a nicely formatted thumbnail, title, and time of the it was published. A click of the slideshow will take you to the full news page.</p> <p><em>Created by </em><a href="http://blog.basememara.com/"><em>Basem Emara</em></a><em>.</em></p> <p><em>------------</em></p> <p>If you’re interested, you’re invited to post your own Sitefinity add-on or template. To create a new listing, please visit our “<a href="http://www.sitefinity.com/marketplace/submit-module.aspx">Make a Submission</a>” page.</p> http://www.sitefinity.com/blogs/gabesumner/posts/10-03-08/now_available_in_the_sitefinity_marketplace.aspx Gabe Sumner http://www.sitefinity.com/blogs/gabesumner/posts/10-03-08/now_available_in_the_sitefinity_marketplace.aspx 1ef00f2a-74d9-425d-b92e-efa6a9fa44ca Mon, 08 Mar 2010 21:44:55 GMT How to secure Sitefinity&rsquo;s Administrative UI <p><img style="border-right-width: 0px; margin: 0px 0px 0px 15px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Securing the Sitefinity Login" border="0" alt="Securing the Sitefinity Login" align="right" src="http://www.sitefinity.com/Libraries/MetaBlogLib/WindowsLiveWriter-SecuringtheSitefinityFolder_C5C1-3-3-2010_1-43-52_PM_3.sflb.ashx" width="214" height="192" />Sitefinity’s Administrative Web Interface is accessed by adding <strong>/Sitefinity</strong> to the web site’s URL.&#160; Users are then required to provide a valid username &amp; password to gain entry to Sitefinity.&#160; By default, Sitefinity’s administrative username is set to <strong>admin</strong>.</p> <p>A few customers have expressed concern that this does not offer enough protection from malicious users or bots.&#160; If an attacker knows a web site is using Sitefinity then they also know the login URL and the <strong>admin</strong> username. <em></em>The only thing that remains is the admin password.&#160; </p> <p>This article explains how Sitefinity (and ASP.NET) help protect your web site.&#160; This article also suggests a few techniques for adding additional layers of protection to Sitefinity’s Administrative UI.</p> <h2>Too Many Invalid Password Attempts</h2> <p>There are plenty of password cracking tools that will bombard a web login form with password variations.&#160; These login attempts can stream as fast as the web server can accept them.&#160; After several hours (or days) these automated tools eventually stumble onto a valid password.</p> <p>The first line of defense to these brute force password attacks is to pick a reasonable password.&#160; Dictionary attacks assume the password is a valid word or a common password.&#160; Consequently, passwords containing common words are much easier to guess.&#160; </p> <p>Here are some very general password guidelines:</p> <ul> <li>Passwords should be at least 8 characters longer.&#160; The longer the better… </li> <li>Passwords should be mixed-case </li> <li>Passwords should contain a mixture of numbers &amp; letters </li> <li>Passwords should not use common words </li> </ul> <p>A good password makes it difficult to randomly <em>stumble</em> into the right combination of numbers &amp; letters.&#160; To further discourage these brute force attacks, Sitefinity’s Membership Provider will (by default!) temporarily <em>lock out</em> accounts that have too many failed password attempts.&#160; </p> <p>Sitefinity’s Membership provider is configured in the <strong>~/web.config</strong> file:</p> <pre class="prettyprint">&lt;membership defaultProvider=&quot;Sitefinity&quot; userIsOnlineTimeWindow=&quot;15&quot; hashAlgorithmType=&quot;&quot;&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name=&quot;Sitefinity&quot; connectionStringName=&quot;DefaultConnection&quot; type=&quot;Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider, Telerik.DataAccess&quot; enablePasswordRetrieval=&quot;false&quot; enablePasswordReset=&quot;true&quot; requiresQuestionAndAnswer=&quot;false&quot; applicationName=&quot;/&quot; requiresUniqueEmail=&quot;false&quot; passwordFormat=&quot;Hashed&quot; maxInvalidPasswordAttempts=&quot;5&quot; passwordAttemptWindow=&quot;10&quot; passwordStrengthRegularExpression=&quot;&quot; minRequiredPasswordLength=&quot;1&quot; minRequiredNonalphanumericCharacters=&quot;0&quot;/&gt; &lt;/providers&gt; &lt;/membership&gt;</pre> <p>By default, Sitefinity is configured to limit password attempts (maxInvalidPasswordAttempts) to 5.&#160; The lock out time (passwordAttemptWindow) for the account is set to 10 minutes.&#160; <a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership_properties.aspx">Membership properties</a> can be edited to provide different security settings.&#160; This limits an attacker’s ability to bombard a login form with tons of password variations.</p> <h2>Discourage Brute Force Password Attacks with Captcha</h2> <p>Sitefinity comes included with <a href="http://www.telerik.com/products/aspnet-ajax.aspx">RadControls for ASP.NET AJAX</a>.&#160; Included in this suite of controls is a <a href="http://www.telerik.com/products/aspnet-ajax/captcha.aspx">Captcha control</a>.&#160; This control can be added to Sitefinity’s login to prevent bots from auto-submitting the login form.&#160; Captcha discourages attackers from using automated brute force or dictionary attacks to discover the admin password.&#160; Bypassing Captcha requires human intervention or a <a href="http://caca.zoy.org/wiki/PWNtcha">more sophisticated</a> automated tool.</p> <p>To enable RadCaptcha, insert the following code near the top of the <strong>~/Sitefinity/Login.aspx</strong> page:</p> <pre class="prettyprint">&lt;%@ Register Assembly=&quot;Telerik.Web.UI&quot; Namespace=&quot;Telerik.Web.UI&quot; TagPrefix=&quot;telerik&quot; %&gt;</pre> <p>Then add the RadCaptcha control to the Login control’s LayoutTemplate (just after the RememberMe checkbox):</p> <pre class="prettyprint">&lt;li&gt; &lt;telerik:RadCaptcha ID=&quot;RadCaptcha1&quot; ErrorMessage=&quot;Invalid Captcha&quot; ValidationGroup=&quot;LoginBox&quot; CaptchaImage-BackgroundNoise=&quot;Low&quot; CaptchaImage-FontWarp=&quot;Low&quot; CaptchaImage-LineNoise=&quot;Low&quot; CaptchaImage-TextLength=&quot;5&quot; runat=&quot;server&quot; /&gt; &lt;/li&gt;</pre> <p>Each login to Sitefinity will now also require Captcha.</p> <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Adding Captcha to Sitefinity&#39;s Login Screen" border="0" alt="Adding Captcha to Sitefinity&#39;s Login Screen" src="http://www.sitefinity.com/Libraries/MetaBlogLib/WindowsLiveWriter-SecuringtheSitefinityFolder_C5C1-3-3-2010_6-34-34_PM_3.sflb.ashx" width="604" height="608" /> </p> <p>If needed, the Background Noise, Text Warp and Line Noise levels can be set to High.&#160; These settings will make it even harder for computers to <em>read</em> this text.&#160; However, it will also make it harder for your users to read this text.&#160; <a href="http://www.telerik.com/help/aspnet-ajax/radcaptcha.html">RadCaptcha has a lot of interesting properties</a>; feel free to experiment.</p> <p><em>This tip is courtesy of our friends at <a href="http://www.mallsoft.com/">Mallsoft</a>.</em>&#160; </p> <h2>Disable the Admin User</h2> <p>By default Sitefinity’s administrative user is named <strong>admin</strong>.&#160; Using Sitefinity’s Administrative UI a new administrative user can be created and the old <strong>admin</strong> user deleted.&#160; This makes it harder to guess the administrative user login.</p> <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Renaming Sitefinity&#39;s Admin Account" border="0" alt="Renaming Sitefinity&#39;s Admin Account" src="http://www.sitefinity.com/Libraries/MetaBlogLib/WindowsLiveWriter-SecuringtheSitefinityFolder_C5C1-3-4-2010_9-46-45_AM_3.sflb.ashx" width="604" height="524" /> </p> <p>1.&#160; Create a new administrative user and make this user a member of the <strong>administrators</strong> role.&#160; </p> <p>2.&#160; Log out and then login using this new administrative user.&#160; </p> <p>3.&#160; <strong><em>Test thoroughly before removing the original admin user!</em></strong></p> <p>4.&#160; Before the the old <strong>admin</strong> user can be deleted this account must be removed from the <strong>administrators</strong> role.&#160; </p> <p>5.&#160; After this role has been removed the original <strong>admin</strong> user can be deleted.</p> <h2>Limit access to Sitefinity’s Administrative UI</h2> <p>Access to Sitefinity’s Administrative UI can also be limited using a custom HttpModule (<a href="http://www.sitefinity.com/support/forums/sitefinity-3-x/security/securing-the-administrator-module.aspx">as detailed here</a>).&#160; HttpModules can filter incoming HTTP requests before content is served.&#160; Incoming content requests can be rejected or redirected based on custom parameters (for example, the user’s IP address).</p> <p>The following example limits access to Sitefinity’s Administrative UI to a specific block of IP addresses.</p> <p><strong>~/App_Code/AdminIpFilter.cs</strong></p> <pre class="prettyprint">using System; using System.Web; public class AdminIpFilter : IHttpModule { public void Dispose() { } public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } void context_BeginRequest(object sender, EventArgs e) { HttpContext current = HttpContext.Current; string filePath = current.Request.AppRelativeCurrentExecutionFilePath.ToLower(); if (filePath.StartsWith(&quot;~/sitefinity&quot;)) { string userIp = current.Request.ServerVariables[&quot;REMOTE_ADDR&quot;]; if (userIp.StartsWith(&quot;127.0.0&quot;) == false) { current.Response.Redirect(&quot;http://www.sitefinity.com&quot;); } } } }</pre> <p>This custom HttpModule can be installed in the <strong>~/web.config</strong> file:</p> <pre class="prettyprint">&lt;httpModules&gt; &lt;add name=&quot;AdminIpFilter&quot; type=&quot;AdminIpFilter, App_Code&quot;/&gt; &lt;/httpModules&gt;</pre> <h2>Track Administrative Accesses Using Google Analytics</h2> <p>There is a Sitefinity KB article that describes <a href="http://www.sitefinity.com/support/kb/sitefinity-3-x/how-to-implement-google-analytics-into-sitefinity.aspx">how to add Google Analytics to a Sitefinity web site</a>.&#160; This article describes how to add Google Analytics to public Sitefinity pages (not Admin pages).&#160; Thankfully, the same technique works for Backend Admin pages.</p> <p>To add tracking to Sitefinity’s Administrative UI, the Google Analytics tracking code needs added to the Master Page Template used by Sitefinity’s Admin Pages:&#160; </p> <p><strong>~/Sitefinity/Admin/Admin.master</strong></p> <p>In addition, the Google Analytics tracking code also needs added to the Login Page: </p> <p><strong>~/Sitefinity/Login.aspx</strong></p> <p>Below is a sample Google Analytics tracking code.&#160;&#160; <em>Each web site will have its own unique tracking code.</em></p> <pre class="prettyprint">&lt;script type=&quot;text/javascript&quot;&gt; var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;); document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;)); &lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; try { var pageTracker = _gat._getTracker(&quot;UA-99992654-1&quot;); pageTracker._trackPageview(); } catch(err) {}&lt;/script&gt;</pre> <h2>Change Sitefinity’s Administrative Login URL</h2> <p>Sitefinity’s administrative login can be guessed because all Sitefinity web sites use the very same login URL.&#160; The login URL can be changed by renaming Sitefinity’s Login page:</p> <ol> <li>Rename <strong>~/Sitefinity/Login.aspx</strong> to <strong>~/Sitefinity/ObscureLogin.aspx</strong> </li> <li>Rename <strong>~/Sitefinity/Login.aspx.cs</strong> to <strong>~/Sitefinity/ObscureLogin.aspx.cs</strong> </li> <li>Rename <strong>~/Sitefinity/App_LocalResources/Login.aspx.resx</strong> to <strong>~/Sitefinity/App_LocalResources/ObscureLogin.aspx.resx</strong> </li> </ol> <p>Sitefinity’s Administrative UI can now only be accessed using a special login URL:</p> <p><strong>http://yourwebsite.com/Sitefinity/ObscureLogin.aspx</strong></p> <p>Any other URL will attempt to redirect to <strong>~/Login.aspx</strong> (which no longer exists) and will throw a 404 error.&#160; The user will need to know the login URL before they gain access to Sitefinity’s Admin. UI.&#160; </p> <p><em>This technique is known as </em><a href="http://en.wikipedia.org/wiki/Security_through_obscurity"><em>security through obscurity</em></a><em>; it certainly isn’t bullet-proof but might serve as a first line of defense.</em></p> <h2>Conclusion</h2> <p>In most cases Sitefinity’s default settings coupled with a good password will be enough to discourage most attackers.&#160; However, if this does not provide sufficient protection the techniques described above will install several additional hurdles: </p> <ol> <li>The admin URL is not easily guessable </li> <li>The admin username is not easily guessable </li> <li>The admin password is not easily guessable </li> <li>Accounts with too many failed password attempts are temporarily locked out </li> <li>Captcha discourages automated scripts from submitting the login form </li> <li>Only specific IP addresses can access the admin pages </li> <li>Admin access can be monitored with Google Analytics </li> </ol> <p>If you’ve discovered additional tips or tricks please post a comment below.</p> http://www.sitefinity.com/blogs/gabesumner/posts/10-03-04/how_to_secure_sitefinity_rsquo_s_administrative_ui.aspx Gabe Sumner http://www.sitefinity.com/blogs/gabesumner/posts/10-03-04/how_to_secure_sitefinity_rsquo_s_administrative_ui.aspx 68e941d4-eb2a-42bd-8564-95b141114bf8 Thu, 04 Mar 2010 17:34:45 GMT Send items from Images and Documents module as e-mail attachments In this blog post we will sample a custom control which allows users to select files uploaded to images and documents module and send them as e-mail attachments. We will create a custom control and make it look similar to the built in Download List control. However this control will allow users to select content items and send them to provided e-mail. Bellow is a sample of how our control will look like. <div><br /> </div> <div><img alt="My Download List control" src="http://www.sitefinity.com/Blogs_Libraries/RGeorgievFiles/mydownloadlist.sflb.ashx" /><br /> </div> <div><br /> </div> <div>Let us first start by creating the control template for our custom control. We will populate the items in a <a href="http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx">RadGrid for ASP.NET AJAX</a> as this control allows us to handle multiple selected items out of the box. We will make the control display items in a fashion similar to the built in Download List control. We will also need to add a text box for inputting user e-mail, a couple of validators for validating correct e-mails and a button, which when clicked will send items to specified e-mail address. The sample control template can be found bellow:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%@ Control Language="C#" %&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:RadGrid</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ItemsGrid"</code>  <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">AllowAutomaticInserts</code><code style="color: #000000; ">=</code><code style="color: blue; ">"False"</code> <code style="color: #808080; ">AllowAutomaticUpdates</code><code style="color: #000000; ">=</code><code style="color: blue; ">"False"</code> <code style="color: #808080; ">AllowAutomaticDeletes</code><code style="color: #000000; ">=</code><code style="color: blue; ">"False"</code> <code style="color: #808080; ">ShowStatusBar</code><code style="color: #000000; ">=</code><code style="color: blue; ">"True"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">AllowPaging</code><code style="color: #000000; ">=</code><code style="color: blue; ">"True"</code> <code style="color: #808080; ">PageSize</code><code style="color: #000000; ">=</code><code style="color: blue; ">"50"</code> <code style="color: #808080; ">EnableViewState</code><code style="color: #000000; ">=</code><code style="color: blue; ">"True"</code> <code style="color: #808080; ">Skin</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity"</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">AllowMultiRowSelection</code><code style="color: #000000; ">=</code><code style="color: blue; ">"True"</code> <code style="color: #808080; ">GridLines</code><code style="color: #000000; ">=</code><code style="color: blue; ">"None"</code> <code style="color: #808080; ">AutoGenerateColumns</code><code style="color: #000000; ">=</code><code style="color: blue; ">"False"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">MasterTableView</code> <code style="color: #808080; ">AllowMultiColumnSorting</code><code style="color: #000000; ">=</code><code style="color: blue; ">"false"</code> <code style="color: #808080; ">CommandItemDisplay</code><code style="color: #000000; ">=</code><code style="color: blue; ">"None"</code> <code style="color: #808080; ">CssClass</code><code style="color: #000000; ">=</code><code style="color: blue; ">"listItems listItemsBindOnClient"</code> <code style="color: #808080; ">Width</code><code style="color: #000000; ">=</code><code style="color: blue; ">"98%"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">Columns</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridClientSelectColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"CheckboxSelectColumn"</code> <code style="color: #808080; ">Text</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Select"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridClientSelectColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridBoundColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ID"</code> <code style="color: #808080; ">DataField</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ID"</code> <code style="color: #808080; ">Visible</code><code style="color: #000000; ">=</code><code style="color: blue; ">"false"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridBoundColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Name"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Name"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"DownloadLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Name"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Extension"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Extension"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Extension"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Author"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Author"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Author"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;    </code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"UploadDate"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Upload Date"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"UploadDate"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;    </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Size"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Size"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Size"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code> <code style="color: #808080; ">UniqueName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"FileDownloadLink"</code> <code style="color: #808080; ">HeaderText</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Download Link"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"FileDownloadLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Text</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Download Item"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:GridTemplateColumn</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">Columns</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">MasterTableView</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ClientSettings</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">Selecting</code> <code style="color: #808080; ">AllowRowSelect</code><code style="color: #000000; ">=</code><code style="color: blue; ">"true"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ClientSettings</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">PagerStyle</code> <code style="color: #808080; ">Mode</code><code style="color: #000000; ">=</code><code style="color: blue; ">"NumericPages"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code> </code><span style="margin-left: 3px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:RadGrid</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Label</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailTxtLbl"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">AssociatedControlID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailTxt"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Label</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:RadTextBox</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailTxt"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Skin</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity"</code> <code style="color: #808080; ">ValidationGroup</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sendemail"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:RadTextBox</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%--Regular expression validatior to ensure valid e-mail addresses are provided--%&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:RegularExpressionValidator</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailValidator"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Display</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Dynamic"</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">ErrorMessage</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Please, enter valid e-mail address."</code> <code style="color: #808080; ">ValidationExpression</code><code style="color: #000000; ">=</code><code style="color: blue; ">"^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">ControlToValidate</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailTxt"</code> <code style="color: #808080; ">ValidationGroup</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sendemail"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code> </code><span style="margin-left: 3px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:RegularExpressionValidator</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%-- a validator to ensure e-mails are entered before the send button is clicked--%&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:RequiredFieldValidator</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Requiredfieldvalidator1"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Display</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Dynamic"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">ControlToValidate</code><code style="color: #000000; ">=</code><code style="color: blue; ">"emailTxt"</code> <code style="color: #808080; ">ErrorMessage</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Please, enter an e-mail!"</code> <code style="color: #808080; ">ValidationGroup</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sendemail"</code><code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"SendBtn"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Text</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Send Selected"</code> <code style="color: #808080; ">CausesValidation</code><code style="color: #000000; ">=</code><code style="color: blue; ">"true"</code> <code style="color: #808080; ">ValidationGroup</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sendemail"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> </div> <br /> </div> <div>After we have created the control template for our control it is time to start building it. The control will inherit from Simple control. It will also implement the IFilterableContentControl to allow us to use filter expressions and filter content which will populate the grid. First lets get a reference of the controls in the template:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">CreateChildControls()</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(Page == </code><code style="color: #006699; font-weight: bold; ">null</code> <code style="color: #000000; ">|| DesignMode)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">Label noDesignModeLabel = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">Label();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">noDesignModeLabel.Text = </code><code style="color: blue; ">"The Download List control cannot be rendered in Design Mode"</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Controls.Add(noDesignModeLabel);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.CreateChildControls();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">libraryManager = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">LibraryManager(ProviderName);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #008200; ">//subscribe to comand event of the send button</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">SendButton.Command += </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">CommandEventHandler(SendButton_Command);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #008200; ">//subscibe to the ItemDataound event handler of the RadGrid </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">ItemsGrid.ItemDataBound += </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">GridItemEventHandler(ItemsGrid_ItemDataBound);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #008200; ">//check for filter expression</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(FilterExpression != </code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">.Empty)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">//if we have specified a filter expression we will get only content which matches our filter expression</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">ContentFilterBuilder filterBuilder = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">ContentFilterBuilder(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(filterBuilder.IsFilterValid)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">ItemsGrid.DataSource = libraryManager.GetContent(0, 0, filterBuilder.ParseMetaFieldsFilter(), filterBuilder.ParseParentsFilter());</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">//if there is no filter expression we will only get content from non image libraries</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">ItemsGrid.DataSource = libraryManager.GetContent(0,0,</code><code style="color: blue; ">"Name ASC"</code><code style="color: #000000; ">,</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.GetParentIds());</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">ItemsGrid.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #008200; ">//gets IDs of libraries which are not Image type libraries</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #000000; ">Guid[] GetParentIds()</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">List&lt;Guid&gt; parentIDs = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">List&lt;Guid&gt;();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(ILibrary library </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">libraryManager.GetAllLibraries(</code><code style="color: blue; ">"Image"</code><code style="color: #000000; ">, </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">))</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">parentIDs.Add(library.ID);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #000000; ">parentIDs.ToArray();</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div><br /> </div> <div>As you can see from the inline comments above we need to subscribe to the ItemDataBound event of the grid control. In this event we will populate the meta data and download links for each item in the grid. Bellow is the code for this event handler:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">ItemsGrid_ItemDataBound(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, GridItemEventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(e.Item </code><code style="color: #006699; font-weight: bold; ">is</code> <code style="color: #000000; ">GridDataItem)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">IContent cnt = (IContent)e.Item.DataItem;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(var MetaKey </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">libraryManager.MetaKeys)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">ITextControl textControl = (ITextControl)e.Item.FindControl(MetaKey.Key);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(textControl != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">textControl.Text = cnt.GetMetaData(MetaKey.Key).ToString();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(MetaKey.Key == </code><code style="color: blue; ">"Size"</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">long</code> <code style="color: #000000; ">num;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">long</code><code style="color: #000000; ">.TryParse(textControl.Text, </code><code style="color: #006699; font-weight: bold; ">out</code> <code style="color: #000000; ">num);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">textControl.Text = LibraryHelper.FormatSizeString(num);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">}   </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">Literal UploadDate = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"UploadDate"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">HyperLink DownloadLink = (HyperLink)e.Item.FindControl(</code><code style="color: blue; ">"DownloadLink"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">HyperLink FileDownloadLink = (HyperLink)e.Item.FindControl(</code><code style="color: blue; ">"FileDownloadLink"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(UploadDate != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">UploadDate.Text = cnt.DateCreated.ToShortDateString();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(DownloadLink != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">DownloadLink.NavigateUrl = cnt.UrlWithExtension;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(FileDownloadLink != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">FileDownloadLink.NavigateUrl = cnt.UrlWithExtension;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div>We also need to handle the click event of the send button. When this button is clicked we will get all selected items from the grid and add them as attachments to an e-mail message. You will need to have valid SMTP setting in order to make this work:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">SendButton_Command(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, CommandEventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">GridItemCollection selectedItems = ItemsGrid.SelectedItems;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">MailMessage newMesssage = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">MailMessage();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//modify this to fit your requirements</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">newMesssage.From = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">MailAddress(</code><code style="color: blue; ">"admin@mymail.com"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">newMesssage.To.Add(</code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">MailAddress(EmailText.Text));</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">message = String.Format(</code><code style="color: blue; ">"Message body"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(GridDataItem item </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">ItemsGrid.SelectedItems)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">libraryManager = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">LibraryManager();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">TableCell id = item[</code><code style="color: blue; ">"ID"</code><code style="color: #000000; ">];</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">IContent contentItem = libraryManager.GetContent(</code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">Guid(id.Text));</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">name = contentItem.GetMetaData(</code><code style="color: blue; ">"Name"</code><code style="color: #000000; ">).ToString();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">MemoryStream stream = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">MemoryStream((</code><code style="color: #006699; font-weight: bold; ">byte</code><code style="color: #000000; ">[])contentItem.Content);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">Attachment attachment = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">Attachment(stream, String.Concat(name, contentItem.GetMetaData(</code><code style="color: blue; ">"Extension"</code><code style="color: #000000; ">).ToString()), contentItem.MimeType);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">newMesssage.Attachments.Add(attachment);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">SmtpClient smtpClient = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">SmtpClient();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">smtpClient.Send(newMesssage); </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div>This is the basic functionality of the control, which needs to be implemented. The complete code for the control and markup for its template can be downloaded from this link: <a href="http://www.sitefinity.com/Blogs_Libraries/RGeorgievFiles/MyDownloadListSource.sflb.ashx">MyDownloadListSource</a></div> http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-03-03/send_items_from_images_and_documents_module_as_e-mail_attachments.aspx Radoslav Georgiev http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-03-03/send_items_from_images_and_documents_module_as_e-mail_attachments.aspx d29f8334-5bb2-4499-a02d-1a738171cb2e Wed, 03 Mar 2010 12:35:00 GMT Expose SpamProtector (Captcha) as a public property of a ContentView based control <p>Each ContentView based control represents content items that have been created from the backend or programmatically. The ContentView based control has two modes</p> <ul> <li>List - shows all items as a list.</li> <li>Details - shows a single item from the list.</li> </ul> <p>Build-in ContentView based controls are - <strong>EventsView, BlogPosts, NewsView,</strong> <strong>ContentView </strong>control, ImageGalley, DownloadList. The last two controls are ContentView based, but they have different presentation modes, because they are supposed to show data from Images and Documents module.</p> <p>For each ContentView control you can enable comments. Enabling comments can be done through the control's <strong>Advanced/Properties </strong>tab where you will find <strong>Comments </strong>section. Once you have enabled the comments you may need to protect the form from online spammers. By default, <strong>SpamProtection is not enabled</strong> on Sitefinity comment. There is no public property that you can use to do this. Since 3.6 Sitefinity uses embedded templates, so first you need to map external template - ListPageDetails.ascx, then you need to find the SpamPropector declaration at the bottom of the template and enable SpamProtector control. You can save all these steps by creating a simple control that inherits from one of the ContentView based control and expose <strong>an user friendly public property</strong>. Then you only have to use this control instead of the built-in and set the custom property from the control designer.</p> <p>1. Create a custom control that inherits from BlogPosts( or another ContentView based control).&nbsp; </p> <p>2. Override SingleItemTemplatePath and ItemListTemplatePath properties where you need to set the path to external templates that the control will use in List and Details mode.</p> <p>3. Create a ViewState property of Boolean type (true/false) that you will use in the control designer. You can set Category and Description of this property, so that you can find it easily under <strong>Advanced/Properties</strong> tab. All properties that do not have Category set are added under <strong>Misc </strong>section.</p> <p>4. Crete a control references to <strong>RadEditor </strong>and <strong>SpamPropector </strong>controls. You can find the controls from the control's <strong>SingleContainer</strong>.</p> <p>5. Override <strong>CreateSingleContent </strong>method, set the RadEditor as visible and check the value of the custom property - ShowCaptcha.</p> <p></p> <div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">class</code> <code style="color: #000000;">BlogPostsCustomControl : BlogPosts</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #000000;">BlogPostsCustomControl()</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 15px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">string</code>&nbsp; <code style="color: #000000;">SingleItemTemplatePath</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 15px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 15px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{ </code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: blue;">"~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageDetail.ascx"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 15px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">string</code>&nbsp; <code style="color: #000000;">ItemListTemplatePath</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{ </code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 27px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: blue;">"~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageMaster.ascx"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">virtual</code> <code style="color: #006699; font-weight: bold;">bool</code> <code style="color: #000000;">ShowCaptcha</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">obj = ViewState[</code><code style="color: blue;">"ShowCaptcha"</code><code style="color: #000000;">];</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(obj != </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">(</code><code style="color: #006699; font-weight: bold;">bool</code><code style="color: #000000;">)obj;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #006699; font-weight: bold;">true</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">set</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">ViewState[</code><code style="color: blue;">"ShowCaptcha"</code><code style="color: #000000;">] = value;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span><code>&nbsp; <br /> </code></span></div> <span><span style="margin-left: 0px ! important;">&nbsp;</span></span> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">CreateSingleContent()</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">base</code><code style="color: #000000;">.CreateSingleContent();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">Editor.Visible = </code><code style="color: #006699; font-weight: bold;">true</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(ShowCaptcha)</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">Captcha.EnableCaptcha = </code><code style="color: #006699; font-weight: bold;">true</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">Captcha.Visible = </code><code style="color: #006699; font-weight: bold;">true</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">else</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">Captcha.Visible = </code><code style="color: #006699; font-weight: bold;">false</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">virtual</code> <code style="color: #000000;">SpamProtector Captcha</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">((Telerik.Web.UI.SpamProtection.SpamProtector)((Telerik.Blogs.WebControls.BlogCommentsList)(</code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.SingleContainer.CommentsListCtrl)).Controls[0].FindControl(</code><code style="color: blue;">"spamProtector"</code><code style="color: #000000;">));</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">virtual</code> <code style="color: #000000;">RadEditor Editor</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 33px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">((Telerik.Blogs.WebControls.BlogCommentsList)(</code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.SingleContainer.CommentsListCtrl)).Controls[0].FindControl(</code><code style="color: blue;">"commentTxt"</code><code style="color: #000000;">) </code><code style="color: #006699; font-weight: bold;">as</code> <code style="color: #000000;">RadEditor;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <p></p> <p></p> http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-03-01/expose_spamprotector_captcha_as_a_public_property_of_a_contentview_based_control.aspx Ivan Dimitrov http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-03-01/expose_spamprotector_captcha_as_a_public_property_of_a_contentview_based_control.aspx 971c7277-ef0f-4f38-9a47-3905ea42000a Mon, 01 Mar 2010 12:53:00 GMT Roles Selector and hiding control based on user's roles In the following blog post I will sample the creation of a custom WebUITypeEditor which will select roles from the default roles provider and return them as a string array. Then I will use this selector in a control derived from Generic Content Control in order to make it "secured" - it will hide its contents to users which do not belong to at least one of the selected roles. Before we start with the implementation I recommend that you first take a look at the following blog post and KB article in order to get a better idea how to build WebUITypeEditors and create controls deriving from Generic Content Control: <div><a href="http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/09-10-27/creating_a_custom_webuitypeeditor.aspx" title="How to create a custom WebUITypeEditor">Creating a custom WebUITypeEditor</a><br /> <div><a href="http://www.sitefinity.com/support/kb/sitefinity-3-x/how-to-wrap-a-generic-content-control-in-3-6-sp1.aspx" title="How to wrap a Generic Content Control">How to wrap a Generic Content Control</a><br /> </div> <div><br /> </div> <div>We will first start with the implementation of the RolesSelector. This clash should inherit WebUITypeEditor. What it will do is to populate the roles within the default role provider into a list box and allow users to select from them. Then it returns the selected roles in the form of a string array. First Lets Create the template for this control. We will place it in <strong>~/Sitefinity/Admin/ControlTemplates/Selectors/RolesSelector.ascx</strong>, bellow is the sample markup:</div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%@ Control Language="C#" %&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">p</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">h2</code><code style="color: #000000; ">&gt;Select roles which will see the control's content.&lt;/</code><code style="color: #006699; font-weight: bold; ">h2</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">p</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Label</code> <code style="color: #808080; ">AssociatedControlID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"RolesSource"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"label1"</code> <code style="color: #808080; ">Text</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Roles to select from:"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Label</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">br</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:RadListBox</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"RolesSource"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">Height</code><code style="color: #000000; ">=</code><code style="color: blue; ">"200px"</code> <code style="color: #808080; ">Width</code><code style="color: #000000; ">=</code><code style="color: blue; ">"200px"</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">AllowTransfer</code><code style="color: #000000; ">=</code><code style="color: blue; ">"true"</code> <code style="color: #808080; ">TransferToID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"RolesDestination"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:RadListBox</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:RadListBox</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"RolesDestination"</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #808080; ">Height</code><code style="color: #000000; ">=</code><code style="color: blue; ">"200px"</code> <code style="color: #808080; ">Width</code><code style="color: #000000; ">=</code><code style="color: blue; ">"200px"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> </div> <br /> </div> <div>Now lets create our actual control. We will bind the first list box control to all roles coming from default role provider. If the view state of the control contains information of previously selected roles will will insert them in the second list box which will contain already selected roles. Sample code bellow:</div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Collections.Generic;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Linq;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Text;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Cms.Web.UI;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Web.UI;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Web.UI;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Framework.Web;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Security;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">namespace</code> <code style="color: #000000; ">Sitefinity.Samples.WebControls</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">class</code> <code style="color: #000000; ">RolesSelector : WebUITypeEditor&lt;</code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">[]&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">[] Value</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">IList&lt;</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">&gt; roles = (</code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">[]{}).ToList();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(RadListBoxItem item </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">RolesDestination.Items)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                   </code><span style="margin-left: 57px !important; "><code style="color: #000000; ">roles.Add(item.Text.ToString());</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #000000; ">roles.ToArray();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ViewState[</code><code style="color: blue; ">"selectedRoles"</code><code style="color: #000000; ">] = value;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">private</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">layoutTemplatePath = </code><code style="color: blue; ">"~/Sitefinity/Admin/ControlTemplates/Selectors/RolesSelector.ascx"</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">Template</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">o = </code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ViewState[</code><code style="color: blue; ">"Template"</code><code style="color: #000000; ">];</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(o == </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.layoutTemplatePath;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #000000; ">(</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">)o;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ViewState[</code><code style="color: blue; ">"Template"</code><code style="color: #000000; ">] = value;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #000000; ">RadListBox RolesSource</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Controls[0].FindControl(</code><code style="color: blue; ">"RolesSource"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #000000; ">RadListBox; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">CreateChildControls()</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.CreateChildControls();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">userManger = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">UserManager();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.template = ControlUtils.GetTemplate&lt;SelectorTemplate&gt;(Template);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.template.InstantiateIn(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">RolesSource.DataSource = userManger.GetAllRoles();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">RolesSource.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ViewState[</code><code style="color: blue; ">"selectedRoles"</code><code style="color: #000000; ">] != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">IList&lt;</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">&gt; selectedRoles = (IList&lt;</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">&gt;)</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ViewState[</code><code style="color: blue; ">"selectedRoles"</code><code style="color: #000000; ">];</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">RolesDestination.DataSource = selectedRoles;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">RolesDestination.ItemDataBound += </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">RadListBoxItemEventHandler(RolesDestination_ItemDataBound);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">RolesDestination.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">RolesDestination_ItemDataBound(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, RadListBoxItemEventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">RadListBoxItem item = RolesSource.FindItemByText(e.Item.Text);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(item != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">RolesSource.Delete(item);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #000000; ">RadListBox RolesDestination</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Controls[0].FindControl(</code><code style="color: blue; ">"RolesDestination"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #000000; ">RadListBox;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">class</code> <code style="color: #000000; ">SelectorTemplate : ITemplate</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: gray; ">#region ITemplate Members</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">InstantiateIn(Control container)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #008200; ">//throw new NotImplementedException();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: gray; ">#endregion</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">private</code> <code style="color: #000000; ">ITemplate template;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">private</code> <code style="color: #000000; ">UserManager userManger; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div>The next step is to create the control which is going to use our RolesSelector. As in the KB article linked above we will create a custom control which inherits from Generic Content Control. Additionally we have to expose a property for setting selected roles and add some more logic to the Render method override. First lets add the property and get a reference of the div containing the actual generic content control:</div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// Gets or sets the roles which are allowed to see content of the cotnrol. We are going to use the RolesSelector for WebEditor</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;/summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">[Browsable(</code><code style="color: #006699; font-weight: bold; ">true</code><code style="color: #000000; ">)]</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">[WebEditor(</code><code style="color: blue; ">"Sitefinity.Samples.WebControls.RolesSelector, Sitefinity.Samples"</code><code style="color: #000000; ">),TypeConverter(</code><code style="color: #006699; font-weight: bold; ">typeof</code><code style="color: #000000; ">(Telerik.Framework.Utilities.StringArrayConverter))]</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">[] Roles</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">obj = </code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.roles;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(obj == </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">[]{};</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #000000; ">(</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">[])obj;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.roles = value;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// The div containing the generic content control</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;/summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">[Browsable(</code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">)]</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #000000; ">HtmlGenericControl ContentWrapper</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">get</code> <code style="color: #000000; ">{ </code><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Container.GetControl&lt;HtmlGenericControl&gt;(</code><code style="color: blue; ">"contentWrapper"</code><code style="color: #000000; ">, </code><code style="color: #006699; font-weight: bold; ">true</code><code style="color: #000000; ">); }</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div>In the method overriding Render we will check if the selected roles property is null and if not check against the current user's roles. If user does not belong to at least one of selected roles the user will not be able to see the content of the control:</div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">Render(HtmlTextWriter writer)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">StringWriter content = </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">HtmlTextWriter contentWriter = </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">try</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #008200; ">// if in normal mode, output the full content of the control</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(!</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.DesignMode)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// first, we need to "extract"</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">content = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">StringWriter();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">contentWriter = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">HtmlTextWriter(content);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.Render(contentWriter);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ContentPlaceholder.Text = content.ToString();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">//check selected roles and set behavior accordingly</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.roles != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">UserManager userManager = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">UserManager();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">MembershipUser currentUser = userManager.GetUser();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(currentUser != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">bool</code> <code style="color: #000000; ">userInRole = </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(</code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">role </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.roles)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">userInRole = userManager.IsUserInRole(role);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(userInRole == </code><code style="color: #006699; font-weight: bold; ">true</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #006699; font-weight: bold; ">break</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(userInRole == </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">ContentWrapper.Visible = </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">ContentWrapper.Visible = </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// we need to do this manually, as generic content control renders its</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// content directly and does not inherit CompositeControl,</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// so it will not render out template correctly (not at all, actually)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(Control child </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Controls)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">child.RenderControl(writer);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(!</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Controls.Contains(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Container))</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.Container.RenderControl(writer);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// if in edit (design) mode, output the content of the genreric content control</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #008200; ">// THIS IS REQUIRED</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.Render(writer);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">finally</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(content != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">content.Dispose();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(contentWriter != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">contentWriter.Dispose();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>   </code><span style="margin-left: 9px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <br /> </div> <div>You should note that overriding the render method is required when you are dealing with control inheriting from Generic Content Control. If you are going to create a custom control which inherits from SimpleControl for example you need to override CreateChildControls() and place the logic for hiding content there. If the user does not belong to selected roles you can simply clear the control collection - nothing will be displayed.</div> <div><br /> </div> <div>Sample project can be downloaded from this link: <a sfref="[Blogs_Libraries]aef2004b-d905-470e-9820-c769469ca269">RolesSelector</a>. The roles selector and custom generic content control are packed in a code library. After you add this to your solution you fix the assembly references in the Sitefinity.Samples project. Then add the Sitefinity.Samples project as a project reference in your Sitefinity website and build the Sitefinity.Samples project. Finally add the custom control to your toolbox, include this in your web.config:</div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">toolboxControls</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>  </code><span style="margin-left: 6px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">clear</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>  </code><span style="margin-left: 6px !important; "><code style="color: #000000; ">...</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>  </code><span style="margin-left: 6px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">add</code> <code style="color: #808080; ">name</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Custom Generic Content"</code> <code style="color: #808080; ">section</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity Samples"</code> <code style="color: #808080; ">type</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity.Samples.WebControls.GCWrapper, Sitefinity.Samples"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">toolboxControls</code><code style="color: #000000; ">&gt;</code></span></span></div> </div> <br /> </div> </div> http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-22/roles_selector_and_hiding_control_based_on_user_s_roles.aspx Radoslav Georgiev http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-22/roles_selector_and_hiding_control_based_on_user_s_roles.aspx 9fbea1b7-9f75-479f-874e-7f4c0504525a Mon, 22 Feb 2010 15:00:38 GMT Download List control to group items for download by parent library This week's Tip of the Week blog post is going to sample a custom download list control. The difference between this control and the built-in one is that the custom one is going to display the downloadable items in separate tables, broken down by parent libraries to which they belong. Bellow you can see the resulting look and feel of the control: <div><br /> <div><img src="http://www.sitefinity.com/Blogs_Libraries/RGeorgievFiles/customdownloadlistctrl.sflb.ashx" alt="Custom Download List control" /><br /> </div> <div><br /> </div> <div>To achieve this we will need to create a custom control and provide a control template for this control. In this sample I have inherited from DownloadList to utilize the existing ability to select libraries from which we wish to display items for download. What we will do is to create a custom template which has two nested repeaters. The outer one will display library name and the inned one will display content items belonging to his library. Bellow is the sample code for the CustomDonwloadList control:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Collections;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Collections.Generic;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Globalization;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Linq;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Web.UI.WebControls;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Cms.Engine;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Cms.Engine.ContentViewFiltering;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Cms.Engine.WebControls;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Libraries;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;summary&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// Summary description for CustomDownloadList</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;/summary&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">class</code> <code style="color: #000000; ">CustomDownloadList: DownloadList</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//set template path for the control template</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">ItemListTemplatePath</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: blue; ">"~/CustomControls/ControlTemplates/CustomDonwloadList.ascx"</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ItemListTemplatePath = value;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">ProviderName</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: blue; ">"Libraries"</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ProviderName = value;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//here we populate our libraries repeater with selected libraries</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">protected</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">CreateContentList()</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">ContentFilterBuilder filterBuilder = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">ContentFilterBuilder(</code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">libraryManager = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">LibraryManager();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">IList libraries =  </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">Guid[] parentIds = filterBuilder.ParseParentsFilter();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(parentIds.Count()&gt;0)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">List&lt;ILibrary&gt; libs = </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">List&lt;ILibrary&gt;();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">foreach</code> <code style="color: #000000; ">(Guid id </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">parentIds)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">libs.Add(libraryManager.GetLibrary(id));</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">libraries = libs.ToList();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">libraries = libraryManager.GetAllLibraries(</code><code style="color: blue; ">"Image"</code><code style="color: #000000; ">, </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #008200; ">//sort libraries in ascendding order by name</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">IQueryable&lt;ILibrary&gt; librariesQ = libraries.Cast&lt;ILibrary&gt;().AsQueryable&lt;ILibrary&gt;();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">var sortedLibraries = from list </code><code style="color: #006699; font-weight: bold; ">in</code> <code style="color: #000000; ">librariesQ</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                              </code><span style="margin-left: 90px !important; "><code style="color: #000000; ">orderby list.Name</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                              </code><span style="margin-left: 90px !important; "><code style="color: #000000; ">select list;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">LibrariesRepeater.ItemDataBound+=</code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">RepeaterItemEventHandler(LibrariesRepeater_ItemDataBound);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">LibrariesRepeater.DataSource = sortedLibraries.ToList();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">LibrariesRepeater.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//for each seleceted library create the table containing content items</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">LibrariesRepeater_ItemDataBound(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, RepeaterItemEventArgs e)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">ILibrary library = (ILibrary)e.Item.DataItem;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(library.ItemsCount &gt; 0)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">Literal LibraryName = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"LibraryName"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">Repeater ItemsRepeater = (Repeater)e.Item.FindControl(</code><code style="color: blue; ">"itemsRepeater"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(ItemsRepeater != </code><code style="color: #006699; font-weight: bold; ">null</code> <code style="color: #000000; ">&amp;&amp; LibraryName!=</code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">LibraryName.Text = library.Name;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">IList items = library.GetItems();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">ItemsRepeater.ItemDataBound += </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">RepeaterItemEventHandler(ItemsRepeater_ItemDataBound);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">ItemsRepeater.DataSource = items;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">ItemsRepeater.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//set meta data for each item displayed in the downloads table</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">ItemsRepeater_ItemDataBound(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, RepeaterItemEventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">HyperLink DownloadLink = (HyperLink)e.Item.FindControl(</code><code style="color: blue; ">"DownloadLink"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Literal Title = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"Title"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Literal Description = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"Description"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Literal Extension = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"Extension"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Label Author = (Label)e.Item.FindControl(</code><code style="color: blue; ">"Author"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Literal UploadDate = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"UploadDate"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Literal Size = (Literal)e.Item.FindControl(</code><code style="color: blue; ">"Size"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Repeater Tags = (Repeater)e.Item.FindControl(</code><code style="color: blue; ">"Tags"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">HyperLink FileFileDownloadLink = (HyperLink)e.Item.FindControl(</code><code style="color: blue; ">"FileDownloadLink"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">IContent contentItem = (IContent)e.Item.DataItem;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(contentItem.MimeType.StartsWith(</code><code style="color: blue; ">"Video"</code><code style="color: #000000; ">, </code><code style="color: #006699; font-weight: bold; ">true</code><code style="color: #000000; ">, CultureInfo.InvariantCulture))</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">DownloadLink.NavigateUrl = </code><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ResolveUrl(</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">.Format(</code><code style="color: blue; ">"{0}?download=true"</code><code style="color: #000000; ">, contentItem.UrlWithExtension));</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">else</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">DownloadLink.NavigateUrl = </code><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ResolveUrl(contentItem.UrlWithExtension);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">FileFileDownloadLink.NavigateUrl = </code><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ResolveUrl(</code><code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">.Format(</code><code style="color: blue; ">"{0}?download=true"</code><code style="color: #000000; ">, contentItem.UrlWithExtension));</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Title.Text = contentItem.GetMetaData(</code><code style="color: blue; ">"Name"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Description.Text = contentItem.GetMetaData(</code><code style="color: blue; ">"Description"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Extension.Text = contentItem.GetMetaData(</code><code style="color: blue; ">"Extension"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Author.Text = contentItem.GetMetaData(</code><code style="color: blue; ">"Author"</code><code style="color: #000000; ">) </code><code style="color: #006699; font-weight: bold; ">as</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">UploadDate.Text = contentItem.DateCreated.ToShortDateString();</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Size.Text = contentItem.GetMetaData(</code><code style="color: blue; ">"Size"</code><code style="color: #000000; ">).ToString();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">long</code> <code style="color: #000000; ">num;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">long</code><code style="color: #000000; ">.TryParse(Size.Text, </code><code style="color: #006699; font-weight: bold; ">out</code> <code style="color: #000000; ">num);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Size.Text = LibraryHelper.FormatSizeString(num);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Tags.ItemDataBound += </code><code style="color: #006699; font-weight: bold; ">new</code> <code style="color: #000000; ">RepeaterItemEventHandler(Tags_ItemDataBound);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Tags.DataSource = libraryManager.GetTags(contentItem.ID);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">Tags.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">Tags_ItemDataBound(</code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">sender, RepeaterItemEventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">ITag dataItem = (ITag)e.Item.DataItem;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">HyperLink link = (HyperLink)e.Item.FindControl(</code><code style="color: blue; ">"tagLink"</code><code style="color: #000000; ">);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(link != </code><code style="color: #006699; font-weight: bold; ">null</code><code style="color: #000000; ">)</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">link.Text = dataItem.TagName;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">link.NavigateUrl = </code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.GetTagUrl(dataItem, </code><code style="color: #006699; font-weight: bold; ">this</code><code style="color: #000000; ">.ItemListUrl);</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//get refference to the libraries repeater from control template</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #000000; ">Repeater LibrariesRepeater</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">get</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.ListContainer.GetControl&lt;Repeater&gt;(</code><code style="color: blue; ">"librariesRepeater"</code><code style="color: #000000; ">, </code><code style="color: #006699; font-weight: bold; ">false</code><code style="color: #000000; ">, Telerik.Framework.Web.TraverseMethod.BreadthFirst);</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">set</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">{</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">LibrariesRepeater = value;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">}</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "> </span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">private</code> <code style="color: #000000; ">LibraryManager libraryManager;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> </div> <div><br /> </div> <div>Now we need to provide the markup for our control template. I am going to reuse the one from the Download List Table View mode template:</div> <div><br /> </div> <div> <div class="reCodeBlock" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%@ Control Language="C#" %&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;%--content view controls have a requirerd Repeater control with ID="repeater" add one and set it to not visible--%&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"repeater"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">Visible</code><code style="color: #000000; ">=</code><code style="color: blue; ">"false"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:CssFileLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"CssFileLink1"</code> <code style="color: #808080; ">FileName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"~/CustomControls/ControlTemplates/librariesCommonLayout.css"</code> <code style="color: #808080; ">Media</code><code style="color: #000000; ">=</code><code style="color: blue; ">"screen"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"librariesRepeater"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">p</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"LibraryName"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">p</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"itemsRepeater"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">table</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_libraryGrid"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">thead</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">tr</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"TitleWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal1"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Title %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ExtWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal2"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Extension %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"AuthorWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal3"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Author %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"UploadDateWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal4"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_UploadDate %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"SizeWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal5"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Size %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"TagWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Literal6"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Tags %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"col"</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"DownloadLinkWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">tr</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">thead</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">tbody</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">tr</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">th</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"TitleWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">scope</code><code style="color: #000000; ">=</code><code style="color: blue; ">"row"</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_docTitle"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"DownloadLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                                </code><span style="margin-left: 96px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Title"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Description"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">th</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ExtWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Extension"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"AuthorWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Label</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Author"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Label</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"UploadDateWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_date"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"UploadDate"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"SizeWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_size"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Size"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Literal</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"TagWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Tags"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                                </code><span style="margin-left: 96px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                                    </code><span style="margin-left: 108px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"tagLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                                </code><span style="margin-left: 96px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                            </code><span style="margin-left: 84px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                        </code><span style="margin-left: 72px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">td</code> <code style="color: #808080; ">id</code><code style="color: #000000; ">=</code><code style="color: blue; ">"DownloadLinkWrap"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"FileDownloadLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_Download %&gt;" /&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">td</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">tr</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">tbody</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">table</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">telerik:Pager</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"pager1"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">LayoutTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>         </code><span style="margin-left: 27px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"PageRepeaterLinkButton"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ol</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_pager"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"PreviousPage"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_PreviousPage %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"SingleItem"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"NextPage"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_NextPage %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:LinkButton</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ol</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"PageRepeaterHyperLink"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ol</code> <code style="color: #808080; ">class</code><code style="color: #000000; ">=</code><code style="color: blue; ">"sf_pager"</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"PreviousPage"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_PreviousPage %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">HeaderTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                    </code><span style="margin-left: 60px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"SingleItem"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">/&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ItemTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;&lt;</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code> <code style="color: #808080; ">ID</code><code style="color: #000000; ">=</code><code style="color: blue; ">"NextPage"</code> <code style="color: #808080; ">runat</code><code style="color: #000000; ">=</code><code style="color: blue; ">"server"</code> <code style="color: #000000; ">Text="&lt;%$Resources:Items_NextPage %&gt;"&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:HyperLink</code><code style="color: #000000; ">&gt;&lt;/</code><code style="color: #006699; font-weight: bold; ">li</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>                </code><span style="margin-left: 48px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">ol</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">FooterTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">asp:Repeater</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">LayoutTemplate</code><code style="color: #000000; ">&gt;</code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">telerik:Pager</code><code style="color: #000000; ">&gt;</code></span></span></div> </div> <br /> </div> <div>Finally all you have to do is add the control to your Sitefinity toolbox.</div> <div><br /> </div> <div>You can download the control source code, markup for template, style sheet and localization resources file from this link: <a href="http://www.sitefinity.com/Blogs_Libraries/RGeorgievFiles/CustomDownloadList.sflb.ashx">CustomDownloadList</a></div> <div><br /> </div> </div> http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-17/download_list_control_to_group_items_for_download_by_parent_library.aspx Radoslav Georgiev http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-17/download_list_control_to_group_items_for_download_by_parent_library.aspx 1ef63489-cfdb-4c79-b47c-b06b9244c220 Wed, 17 Feb 2010 12:18:46 GMT Optimize backend CategoriesView performance in Sitefinity 3.7 <p>Recently we received several bug reports from some of our customers about problems with CategoriesView performance when they have over 200 categories. We ran some test and it turned out that the counting that we perform and the view structure produced very large output. This leads to server timeout or your browser just hangs on for several minutes before you see all categories. We tried to optimize the counting from the view and made some client binding optimizations to the RadTreeView control which actually displays provider categories. If you experience this problem you can download the attached zip and add it to your project following the setup instructions listed below. </p> <p><strong>How to set up:</strong></p> <p>1. Download and extract the zip archive.</p> <p>2. Add <strong>CategoriesViewCustom</strong>.<strong>cs </strong>to your <strong>App_Code</strong> folder</p> <p>3. Add<strong> CategoriesView.ascx</strong> and <strong>App_LocalResources</strong> to your project. By default the attachment contains <strong>MyTemplate</strong>s folder where these templates reside. If you want to change the templates location, do not forget to alter <strong>LayoutTemplatePath</strong> property of <strong>CategoriesViewCustom</strong> class</p> <p> </p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">string</code> <code style="color: #000000;">LayoutTemplatePath</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: blue;">"<span style="background-color: #ffff00;">PATH TO CategoriesView.ascx"</span></code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <p></p> <p>4. Add/open&nbsp; ~/App_Data/Configuration/<strong>Telerik.Sitefinity.Configuration.ControlsConfig.xml</strong> file which is used for mapping external templates.</p> <p>5. Map the custom template as shown below. Here we replace the built-in view with the custom one.</p> <p>&nbsp;</p> <p> </p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;?</code><code style="color: #006699; font-weight: bold;">xml</code> <code style="color: #808080;">version</code><code style="color: #000000;">=</code><code style="color: blue;">"1.0"</code> <code style="color: #808080;">encoding</code><code style="color: #000000;">=</code><code style="color: blue;">"utf-8"</code><code style="color: #000000;">?&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">controlsConfig</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;</code><span style="margin-left: 6px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">viewMap</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">viewSettings</code> <code style="color: #808080;">hostType</code><code style="color: #000000;">=</code><code style="color: blue;">"Telerik.Libraries.WebControls.Admin.LibrariesControlPanel"</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 18px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">views</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">remove</code> <code style="color: #808080;">name</code><code style="color: #000000;">=</code><code style="color: blue;">"CategoriesView"</code> <code style="color: #000000;">/&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">add</code> <code style="color: #808080;">name</code><code style="color: #000000;">=</code><code style="color: blue;">"CategoriesView"</code> <code style="color: #808080;">viewType</code><code style="color: #000000;">=</code><code style="color: blue;">"CategoriesViewCustom, App_Code"</code><code style="color: #000000;">&gt;&lt;/</code><code style="color: #006699; font-weight: bold;">add</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 18px ! important;"><code style="color: #000000;">&lt;/</code><code style="color: #006699; font-weight: bold;">views</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">&lt;/</code><code style="color: #006699; font-weight: bold;">viewSettings</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;</code><span style="margin-left: 6px ! important;"><code style="color: #000000;">&lt;/</code><code style="color: #006699; font-weight: bold;">viewMap</code><code style="color: #000000;">&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;/</code><code style="color: #006699; font-weight: bold;">controlsConfig</code><code style="color: #000000;">&gt;</code></span></span></div> </div> <p></p> <p>6. Restart the application right after you save <strong>Telerik.Sitefinity.Configuration.ControlsConfig.xml</strong></p> <p>7. Run your website.</p> <p>&nbsp;</p> <p><strong>Attached Files</strong></p> <ul> <li><a href="http://www.sitefinity.com/Blogs_Libraries/IvanDimitrovLibrary/CategoriesViewFix.sflb.ashx" title="CategoriesView.zip">CategoriesView.zip</a></li> </ul> http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-02-15/optimize_backend_categoriesview_performance_in_sitefinity_3_7.aspx Ivan Dimitrov http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-02-15/optimize_backend_categoriesview_performance_in_sitefinity_3_7.aspx 4179d3df-de3e-4018-85de-a7d1de33d144 Mon, 15 Feb 2010 15:15:24 GMT SiteMenu Builder <p>This post will show you how to create custom navigation menu for your website, where you can specify which pages you want to see and which not. There are many cases where you want to have two level navigation or several navigational&nbsp; menus. Each time you will have to do some coding over the menu so that it will start showing the appropriate items/nodes. </p> <p>In this post I am creating a custom class that inherits from WebUITypeEditor. </p> <p>First I am going to build WebUITypeEditor using RadTreeView control which supports multiple selection. This seems to be the most appropriate control to achieve my goal. I will bind the control to a list containing all pages by using the CmsManager.GetPages() method. Then I will return the ID of each node to my property as a Guid array.</p> <p>&nbsp;</p> <p></p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Collections.Generic;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Linq;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Web;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Cms.Web.UI;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Web.UI;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Framework.Web;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Cms;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Collections;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Web.UI;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Cms.Web;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// &lt;summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// Summary description for DynamicMenuBuilderWebUITypeEditor</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// &lt;/summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">class</code> <code style="color: #000000;">DynamicMenuBuilderWebUITypeEditor : WebUITypeEditor&lt;Guid[]&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #000000;">DynamicMenuBuilderWebUITypeEditor()</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #000000;">Guid[] Value</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">Guid pageId = Guid.Empty;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">List&lt;Guid&gt; selectedIds = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">List&lt;Guid&gt;();</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">foreach</code> <code style="color: #000000;">(RadTreeNode node </code><code style="color: #006699; font-weight: bold;">in</code> <code style="color: #000000;">TreeView.SelectedNodes)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(node != </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 60px ! important;"><code style="color: #000000;">CmsSiteMapNode smNode = (CmsSiteMapNode)SiteMap.Provider.FindSiteMapNode(</code><code style="color: blue;">"~/"</code> <code style="color: #000000;">+ node.FullPath + </code><code style="color: blue;">".aspx"</code><code style="color: #000000;">);</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 60px ! important;"><code style="color: #000000;">ICmsPage cmsPage = manager.GetPage(smNode.CmsPage.ID) </code><code style="color: #006699; font-weight: bold;">as</code> <code style="color: #000000;">ICmsPage;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 60px ! important;"><code style="color: #000000;">pageId = cmsPage.ID;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 60px ! important;"><code style="color: #000000;">selectedIds.Add(pageId);</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">selectedIds.ToArray();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">set</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"selectedPage"</code><code style="color: #000000;">] = value; </code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">base</code><code style="color: #000000;">.ChildControlsCreated = </code><code style="color: #006699; font-weight: bold;">false</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">string</code> <code style="color: #000000;">Templte</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">o = </code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"Template"</code><code style="color: #000000;">];</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(o == </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">(</code><code style="color: blue;">"~/CustomControls/PageIDWebEditor.ascx"</code><code style="color: #000000;">);</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">(</code><code style="color: #006699; font-weight: bold;">string</code><code style="color: #000000;">)o;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">set</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"Template"</code><code style="color: #000000;">] = value;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 9px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">CreateChildControls()</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">base</code><code style="color: #000000;">.CreateChildControls();</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.manager = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">CmsManager();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.template = ControlUtils.GetTemplate&lt;SelectorTemplate&gt;(</code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.Templte);</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.template.InstantiateIn(</code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">);</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">var manager = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">CmsManager();</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">IList allPages = manager.GetPages();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.MultipleSelect = </code><code style="color: #006699; font-weight: bold;">true</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataSource = allPages;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataTextField = </code><code style="color: blue;">"MenuName"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataFieldParentID = </code><code style="color: blue;">"ParentID"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataFieldID = </code><code style="color: blue;">"ID"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataNavigateUrlField = </code><code style="color: blue;">"StaticUrl"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">TreeView.DataBind();</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">virtual</code> <code style="color: #000000;">RadTreeView TreeView</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.Controls[0].FindControl(</code><code style="color: blue;">"RadTreeView1"</code><code style="color: #000000;">) </code><code style="color: #006699; font-weight: bold;">as</code> <code style="color: #000000;">RadTreeView;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">class</code> <code style="color: #000000;">SelectorTemplate : ITemplate</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">InstantiateIn(Control container)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">private</code> <code style="color: #000000;">ITemplate template;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">private</code> <code style="color: #000000;">CmsManager manager;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <p></p> <p>My Selector template is shown below. I declared there a RadTreeView instance:</p> <p></p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="PageIDWebEditor.ascx.cs" Inherits="CustomControls_PageIDWebEditor" %&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">asp:Label</code> <code style="color: #808080;">runat</code><code style="color: #000000;">=</code><code style="color: blue;">"server"</code> <code style="color: #808080;">ID</code><code style="color: #000000;">=</code><code style="color: blue;">"Label1"</code> <code style="color: #808080;">Text</code><code style="color: #000000;">=</code><code style="color: blue;">"Select a page from the tree"</code> <code style="color: #000000;">/&gt;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">&lt;</code><code style="color: #006699; font-weight: bold;">telerik:RadTreeView</code> <code style="color: #808080;">ID</code><code style="color: #000000;">=</code><code style="color: blue;">"RadTreeView1"</code> <code style="color: #808080;">runat</code><code style="color: #000000;">=</code><code style="color: blue;">"server"</code> <code style="color: #808080;">Skin</code><code style="color: #000000;">=</code><code style="color: blue;">"Black"</code><code style="color: #000000;">/&gt;</code></span></span></div> </div> <p></p> <p>In the code behind I have to disable the NavigateUrl as otherwise when a node is selected a postback will appear, which will clear the selected nodes collection.</p> <p></p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">partial</code> <code style="color: #006699; font-weight: bold;">class</code> <code style="color: #000000;">CustomControls_PageIDWebEditor : System.Web.UI.UserControl</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">Page_Load(</code><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">sender, EventArgs e)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">RadTreeView1.NodeDataBound += </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">Telerik.Web.UI.RadTreeViewEventHandler(RadTeerView1_NodeDataBound);</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">RadTeerView1_NodeDataBound(</code><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">sender, Telerik.Web.UI.RadTreeNodeEventArgs e)</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">foreach</code> <code style="color: #000000;">(RadTreeNode node </code><code style="color: #006699; font-weight: bold;">in</code> <code style="color: #000000;">RadTreeView1.GetAllNodes())</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">node.NavigateUrl = </code><code style="color: blue;">""</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <br /> <p></p> <p>My selector is ready and now I need a custom control. The custom control will inherit from the well know CompositeControl class. This custom control does not need a template, because the SiteMenu will be dynamically generated.</p> <p>I need a ViewState property from where I will call the WebUITypeEditor. I will use the built-in GuidArrayConverter, so that I will not have to create a custom <span style="color: black;">DictionaryConverter </span>for my property that is not just a simple string </p> <p></p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">[WebEditor(</code><code style="color: blue;">"DynamicMenuBuilderWebUITypeEditor, App_Code"</code><code style="color: #000000;">)]</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">[TypeConverter(</code><code style="color: blue;">"Telerik.Framework.Utilities.GuidArrayConverter, Telerik.Framework"</code><code style="color: #000000;">)]</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #000000;">Guid[] PageIDs</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">obj = </code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"PageIDs"</code><code style="color: #000000;">];</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(obj != </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">(Guid[])obj;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">Guid[0];</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">set</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"PageIDs"</code><code style="color: #000000;">] = value;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <p></p> <p>I will override CreateChildControls() where I will dynamically create a RadMenu control and List of all selected pages. Then, I will bind the menu to this list similar to the way that is used in the custom selector to populate the RadTreeView control.</p> <p></p> <div style="border: 1px solid #7f9db9; overflow-y: auto;" class="reCodeBlock"> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Collections.Generic;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Linq;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Web;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.Web.UI.WebControls;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Cms.Web.UI;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">System.ComponentModel;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Web.UI;</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">using</code> <code style="color: #000000;">Telerik.Cms;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// &lt;summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// Summary description for DynamicMenuBuilder</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #808080;">/// &lt;/summary&gt;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #006699; font-weight: bold;">class</code> <code style="color: #000000;">DynamicMenuBuilder : CompositeControl</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #000000;">DynamicMenuBuilder()</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">protected</code> <code style="color: #006699; font-weight: bold;">override</code> <code style="color: #006699; font-weight: bold;">void</code> <code style="color: #000000;">CreateChildControls()</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">base</code><code style="color: #000000;">.CreateChildControls();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">RadMenu menu = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">RadMenu();</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">var Manager = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">CmsManager();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">List&lt;ICmsPage&gt; selectedPages = </code><code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">List&lt;ICmsPage&gt;();</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">foreach</code> <code style="color: #000000;">(Guid g </code><code style="color: #006699; font-weight: bold;">in</code> <code style="color: #000000;">PageIDs)</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">ICmsPage p = Manager.GetPage(g, </code><code style="color: #006699; font-weight: bold;">false</code><code style="color: #000000;">) </code><code style="color: #006699; font-weight: bold;">as</code> <code style="color: #000000;">ICmsPage;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(p != </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #000000;">selectedPages.Add(p);</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataSource = selectedPages;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataTextField = </code><code style="color: blue;">"MenuName"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataFieldParentID = </code><code style="color: blue;">"ParentID"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataFieldID = </code><code style="color: blue;">"ID"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataNavigateUrlField = </code><code style="color: blue;">"StaticUrl"</code><code style="color: #000000;">;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">menu.DataBind();</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">Controls.Add(menu);</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;">&nbsp;</span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">[WebEditor(</code><code style="color: blue;">"DynamicMenuBuilderWebUITypeEditor, App_Code"</code><code style="color: #000000;">)]</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">[TypeConverter(</code><code style="color: blue;">"Telerik.Framework.Utilities.GuidArrayConverter, Telerik.Framework"</code><code style="color: #000000;">)]</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #006699; font-weight: bold;">public</code> <code style="color: #000000;">Guid[] PageIDs</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">get</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">object</code> <code style="color: #000000;">obj = </code><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"PageIDs"</code><code style="color: #000000;">];</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">if</code> <code style="color: #000000;">(obj != </code><code style="color: #006699; font-weight: bold;">null</code><code style="color: #000000;">)</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 48px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #000000;">(Guid[])obj;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">return</code> <code style="color: #006699; font-weight: bold;">new</code> <code style="color: #000000;">Guid[0];</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;">&nbsp;</span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #006699; font-weight: bold;">set</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">{</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 36px ! important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.ViewState[</code><code style="color: blue;">"PageIDs"</code><code style="color: #000000;">] = value;</code></span></span></div> <div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px ! important;"><code style="color: #000000;">}</code></span></span></div> <div style="background-color: #ffffff;"><span><span style="margin-left: 0px ! important;"><code style="color: #000000;">}</code></span></span></div> </div> <br /> <p></p> <p></p> http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-02-13/sitemenu_builder.aspx Ivan Dimitrov http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-02-13/sitemenu_builder.aspx f381b01b-c5c6-470c-93b2-79f1ed8f5bee Sat, 13 Feb 2010 17:24:47 GMT Implement caching by domain name <p>Sitefinity's built in caching mechanism caches cached objects by relative path, rather than by the full path. Sometimes you may need to display the same page in different sub-domains, and have different information displayed based on what sub-domain the user is on. The purpose of this blog post is to sample how to modify the built in caching providers to store keys for cached objects with a bit more information than the relative path. The code for this sample is provided by Sitefinity Senior Developer Vladimir Vasilev.</p> <p> </p> <p>Sitefiniy comes with two caching providers built-in. They are declared in your web.config in the &lt;caching&gt; config element of the &lt;framework&gt; configuration section:</p> <div class="reCodeBlock" style="border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">caching</code> <code style="color: #808080; ">defaultProvider</code><code style="color: #000000; ">=</code><code style="color: blue; ">"memoryCache"</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">providers</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">add</code> <code style="color: #808080; ">name</code><code style="color: #000000; ">=</code><code style="color: blue; ">"memoryCache"</code> <code style="color: #808080; ">type</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Telerik.Caching.MemoryCachingProvider, Telerik.Framework"</code><code style="color: #000000; ">/&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">add</code> <code style="color: #808080; ">name</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ASPNET"</code> <code style="color: #808080; ">type</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Telerik.Caching.AspNetCachingProvider, Telerik.Framework"</code> <code style="color: #808080; ">duration</code><code style="color: #000000; ">=</code><code style="color: blue; ">"120"</code> <code style="color: #808080; ">slidingExpiration</code><code style="color: #000000; ">=</code><code style="color: blue; ">"true"</code><code style="color: #000000; ">/&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">providers</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">cacheDependency</code> <code style="color: #808080; ">mode</code><code style="color: #000000; ">=</code><code style="color: blue; ">"InMemory"</code><code style="color: #000000; ">/&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">caching</code><code style="color: #000000; ">&gt;</code></span></span></div> </div> <p> </p> <p>Then in the &lt;cms&gt; configuration element you set the default page provider to use either of those two providers. The default setting is to use the ASPNET caching provider, which is a wrapper of the built in ASP.NET caching provider:</p> <div class="reCodeBlock" style="border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">cms</code> <code style="color: #808080; ">defaultProvider</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity"</code> <code style="color: #808080; ">pageExtension</code><code style="color: #000000; ">=</code><code style="color: blue; ">".aspx"</code> <code style="color: #808080; ">disabled</code><code style="color: #000000; ">=</code><code style="color: blue; ">"false"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>   </code><span style="margin-left: 9px !important; "><code style="color: #808080; ">pageEditorUIMode</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Overlay"</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>   </code><span style="margin-left: 9px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">providers</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">clear</code> <code style="color: #000000; ">/&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;</code><code style="color: #006699; font-weight: bold; ">add</code> <code style="color: #808080; ">connectionStringName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"DefaultConnection"</code> <code style="color: #808080; ">allowPageHistory</code><code style="color: #000000; ">=</code><code style="color: blue; ">"true"</code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>     </code><span style="margin-left: 15px !important; "><code style="color: #808080; ">allowPageWorkflow</code><code style="color: #000000; ">=</code><code style="color: blue; ">"false"</code> <span style="background-color: #ffff00; "><code style="color: #808080; ">cachingProviderName</code><code style="color: #000000; ">=</code><code style="color: blue; ">"ASPNET"</code></span> <code style="color: #808080; ">name</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Sitefinity"</code></span></span></div> <div style="background-color: #ffffff; "><span><code>     </code><span style="margin-left: 15px !important; "><code style="color: #808080; ">type</code><code style="color: #000000; ">=</code><code style="color: blue; ">"Telerik.Cms.Data.DefaultProvider, Telerik.Cms.Data"</code> <code style="color: #000000; ">/&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>   </code><span style="margin-left: 9px !important; "><code style="color: #000000; ">&lt;/</code><code style="color: #006699; font-weight: bold; ">providers</code><code style="color: #000000; ">&gt;</code></span></span></div> </div> <p> </p> <p>Based on what you have configured for the caching provider you have two apply one of the bellow described modifications. If you are using ASPNET caching provider, you just have to modify the Global.asax file to add the host name in the key generated for cached objects:</p> <div class="reCodeBlock" style="border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">GetVaryByCustomString(HttpContext context, </code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">custom) </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">if</code> <code style="color: #000000; ">(custom.Equals(</code><code style="color: blue; ">"cms"</code><code style="color: #000000; ">)) </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #000000; ">String.Concat(context.Request.RawUrl, context.Request.Browser.Type, <span style="background-color: #ffff00; ">context.Request.Url.Host</span>).ToLower(); </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.GetVaryByCustomString(context, custom);  </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">}</code></span></span></div> </div> <p> </p> <p>If you are using the MemoryCachingProvider you have to create a custom provider which will inherit from the built-in one and extend the methods for inserting cached objects and retrieving them. Sample code can be found bellow:</p> <div class="reCodeBlock" style="border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">System.Web; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">using</code> <code style="color: #000000; ">Telerik.Caching; </code></span></span></div> <div style="background-color: #ffffff; "><span><code> </code><span style="margin-left: 3px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;summary&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// Summary description for CustomMemoryCachingProvider </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #808080; ">/// &lt;/summary&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">class</code> <code style="color: #000000; ">CustomMemoryCachingProvider: MemoryCachingProvider </code></span></span></div> <div style="background-color: #f8f8f8; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//generate new key based on relative url, domain name, and browser type </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">private</code> <code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">GetNewKey(</code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">oldKey) </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{  </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">HttpContext context = HttpContext.Current; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">string</code><code style="color: #000000; ">.Concat(oldKey, context.Request.Url.Host, context.Request.Browser.Type); </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #ffffff; "><span><code> </code><span style="margin-left: 3px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//insert the custom key instead of original one </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">void</code> <code style="color: #000000; ">Insert(</code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">key, </code><code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">value, System.Web.Caching.CacheDependency dependencies, </code><code style="color: #006699; font-weight: bold; ">int</code> <code style="color: #000000; ">duration, </code><code style="color: #006699; font-weight: bold; ">bool</code> <code style="color: #000000; ">slidingExpiration) </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.Insert(GetNewKey(key), value, dependencies, duration, slidingExpiration); </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #ffffff; "><span><code> </code><span style="margin-left: 3px !important; "> </span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #008200; ">//get cached object based on custom key </code></span></span></div> <div style="background-color: #ffffff; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #006699; font-weight: bold; ">public</code> <code style="color: #006699; font-weight: bold; ">override</code> <code style="color: #006699; font-weight: bold; ">object</code> <code style="color: #000000; ">Get(</code><code style="color: #006699; font-weight: bold; ">string</code> <code style="color: #000000; ">key) </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">{ </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #006699; font-weight: bold; ">return</code> <code style="color: #006699; font-weight: bold; ">base</code><code style="color: #000000; ">.Get(GetNewKey(key)); </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">} </code></span></span></div> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">} </code></span></span></div> </div> <p> </p> <p>After you have implemented the custom MemoryCachingProvider you have to substitute the built-in one with yours in web.config:</p> <div class="reCodeBlock" style="border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; overflow-y: auto; "> <div style="background-color: #ffffff; "><span><span style="margin-left: 0px !important; "><code style="color: #000000; ">&lt;framework&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>    </code><span style="margin-left: 12px !important; "><code style="color: #000000; ">&lt;caching defaultProvider=</code><code style="color: blue; ">"memoryCache"</code><code style="color: #000000; ">&gt; </code></span></span></div> <div style="background-color: #ffffff; "><span><code>        </code><span style="margin-left: 24px !important; "><code style="color: #000000; ">&lt;providers&gt; </code></span></span></div> <div style="background-color: #f8f8f8; "><span><code>            </code><span style="margin-left: 36px !important; "><code style="color: #000000; ">&lt;add name=</code><code style="color: blue; ">"memoryCache"</code> <code style="color: #000000; ">type=</code><code style="color: blue; ">"<span style="background-color: #ffff00; ">CustomMemoryCachingProvider, App_Code</span>"</code><code style="color: #000000; ">/&gt;</code></span></span></div> </div> <p> </p> <p>The above implementation samples how you can easily customize the caching providers to include additional information for objects being stored in cache. You can also include additional information in the key.</p> http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-05/implement_caching_by_domain_name.aspx Radoslav Georgiev http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/10-02-05/implement_caching_by_domain_name.aspx f70b2b38-cd5e-4f47-a420-e5a743c19277 Fri, 05 Feb 2010 13:00:00 GMT Save Images from the Images and Documents module back to the file system When you upload images from your file system to Sitefinity using Images and Documents module all items go to the database as binary object. In some cases you may need to get this Images back to your file system - upload them in another project, back up on the server, user server system as storage instead of the database due to some limits.The built-in implementation of the module does not expose similar option, so I decided to write a simple code for this. <p>Using Sitefinity's API, I get all images from a given library. Each IContent object of this library is an image, so the content of this IContent object is actually the buffer I need to build an image using&nbsp;System.Drawing.Image class.</p> <div style="border: 1px solid #7f9db9; overflow: auto; background-color: white; line-height: 100% ! important; font-family: courier new; font-size: 11px;"> <table cellspacing="0" cellpadding="0" style="border-width: 0px; border-bottom: 0px solid #eeeeee; margin: 2px 0px; width: 99%; border-collapse: collapse; background-color: #ffffff;"> <col style="border-bottom: 1px solid #f7f7f7; font-family: courier new; font-size: 11px; padding-left: 10px; white-space: nowrap;" /> <tbody> <tr> <td><span style="font-size: 11px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">string</span><span style="font-size: 11px;">&nbsp;storage&nbsp;=&nbsp;</span><span style="color: blue;">"C:\\Projects\\Sitefinity\\Images\\"</span><span style="font-size: 11px;">;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;man&nbsp;=&nbsp;<span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;LibraryManager();&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ILibrary&nbsp;lib&nbsp;=&nbsp;man.GetLibrary(<span style="color: blue;">"ImageGallery"</span><span style="font-size: 11px;">);&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IList&nbsp;allImages&nbsp;=&nbsp;lib.GetItems();&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">foreach</span><span style="font-size: 11px;">&nbsp;(IContent&nbsp;contentItem&nbsp;</span><span style="color: blue;">in</span><span style="font-size: 11px;">&nbsp;allImages)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">int</span><span style="font-size: 11px;">&nbsp;i&nbsp;=&nbsp;0;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IContent&nbsp;cnt&nbsp;=&nbsp;man.GetContent(contentItem.ID);&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">string</span><span style="font-size: 11px;">&nbsp;name&nbsp;=&nbsp;(</span><span style="color: blue;">string</span><span style="font-size: 11px;">)cnt.GetMetaData(</span><span style="color: blue;">"Name"</span><span style="font-size: 11px;">);&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">string</span><span style="font-size: 11px;">&nbsp;ext&nbsp;=&nbsp;(</span><span style="color: blue;">string</span><span style="font-size: 11px;">)cnt.GetMetaData(</span><span style="color: blue;">"Extension"</span><span style="font-size: 11px;">);&nbsp;&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">byte</span><span style="font-size: 11px;">[]&nbsp;buffer1&nbsp;=&nbsp;(</span><span style="color: blue;">byte</span><span style="font-size: 11px;">[])cnt.Content;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.Image&nbsp;img&nbsp;=&nbsp;System.Drawing.Image.FromStream(<span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;MemoryStream(buffer1));&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;img.Save(storage&nbsp;+&nbsp;name&nbsp;+&nbsp;ext,&nbsp;ImageFormat.Jpeg);&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i++;&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(i.ToString()&nbsp;+&nbsp;<span style="color: blue;">"-"</span><span style="font-size: 11px;">&nbsp;+&nbsp;</span><span style="color: blue;">"items&nbsp;have&nbsp;been&nbsp;uploaded&nbsp;to:"</span><span style="font-size: 11px;">&nbsp;+&nbsp;storage);&nbsp;</span></td> </tr> </tbody> </table> </div> <br /> <p>Here all my images are jpeg, but you can add switch loop for all commong formats - jpeg, png, bmp, so that the items will be stored with the same extension to your file system. </p> http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-01-31/save_images_from_the_images_and_documents_module_back_to_the_file_system.aspx Ivan Dimitrov http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-01-31/save_images_from_the_images_and_documents_module_back_to_the_file_system.aspx b05c77f5-f4ca-4564-9bfe-b65df614711f Sun, 31 Jan 2010 21:53:13 GMT Building a secured Sitefinity website <p>During the past few weeks I spotted a trend among our customers - web security and hacking concerns. With this blog post, we will cover how Sitefinity is protecting you from being hacked with some of the well known web attacks. We will also mention some of the basics you should keep in mind while building an Asp.Net Website.</p> <h2>Sitefinity against well known web attacks</h2> <h4>SQL Injection and Blind SQL Injection</h4> <p>Before I write why SQL injection is not possible with Sitefinity, here is what <em>Wikipedia</em> says about SQL Injection - <em>code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks</em>.(the entire article - <a href="http://en.wikipedia.org/wiki/SQL_injection" shape="rect">http://en.wikipedia.org/wiki/SQL_injection</a>). </p> <p>SQL Injection attacks are not possible with Sitefinity. Every database query that gets executed is constructed by our Object-Relational Mapper. we do not insert user inputted data into the queries. Furthermore we are using parameterized stored procedures for every API method. It's important to note that if you have any custom functionality, you should be filtering the data before you construct the queries to your own tables, but using an ORM  for your own data layer will still help a lot. With this kind of attack, the user authentication is usually where the hackers try to hit - we use stored procedures for any user authentication as well, so 3rd party sql code will not go to the query. </p> <h4>Cross-site scritping /XSS/ attacks</h4> <p>Again from <em>Wikipedia</em> -<em> a type of computer security vulnerability typically found in web applications which enable malicious attackers to inject client-side script into web pages viewed by other users. An exploited cross-site scripting vulnerability can be used by attackers to bypass access controls such as the same origin policy. Cross-site scripting carried out on websites were roughly 80% of all security vulnerabilities documented by Symantec as of 2007. Their impact may range from a petty nuisance to a significant security risk, depending on the sensitivity of the data handled by the vulnerable site, and the nature of any security mitigations implemented by the site's owner</em>. (the entire article - <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" shape="rect">http://en.wikipedia.org/wiki/Cross-site_scripting</a>)</p> <p>Asp.Net comes with a feature called Event Validation. It basically validates forms and fields upon submitting for any special and "sensitive" characters. The Event validation is enabled by default for all pages and modules in Sitefinity. The event validation can be enabled/disabled from the web.config file:</p> <div style="border: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; "> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">   </span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">pages </span><span style="color: #ff0000;">validateRequest</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"true"</span><span style="font-size: 11px;"> </span><span style="color: #0000ff;">/&gt;</span><span style="font-size: 11px;">   </span></td> </tr> <tr> <td><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p> </p> <p>We use both client side and server side validators wherever it is possible.</p> <h4>Passwords storage</h4> <p>It's a fact that 30% of all web sites across the internet store the user passwords in a plain text. It is a mistake Sitefinity does not do though. Using the default membership providers coming with the application, you will store your users' passwords in <em>hashed + salted form</em>, which makes the reversing impossible.  </p> <h2>Asp.Net features </h2> <p>Beyond the form validation, you should also take care of encrypting the viewstate and the authentication cookies. In Asp.Net, these features are usually turned on by default. The viewstate is encrypted before rendering the page. Every page/template could have its own encryption settings, which could be bad in case many developers are working on the same project. In order to enable the encryption of the viewstates for all pages, the following <strong>web.config</strong> entry is needed:</p> <div style="border: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; "> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">configuration</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">   <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>      <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">pages </span><span style="color: #ff0000;">ViewStateEncryptionMode</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"Always"</span><span style="font-size: 11px;"> </span><span style="color: #0000ff;">/&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">   <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">configuration</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p>The following MSDN article is explaining about the security settings of the authentication cookies, as well as encrypting the ViewState and the cookie in the same way on all servers, when working in load balanced and web farm environments - <a href="http://msdn.microsoft.com/en-us/library/ms998288.aspx" shape="rect">http://msdn.microsoft.com/en-us/library/ms998288.aspx</a></p> <h2> </h2> <h2>Deploying the project </h2> <p>There are several things you should know before you deploy the application on the live server:<br /> - Running in medium trust will prevent file Input/Output operations. usually the only directory in which write rights are possible, is the App_Data directory.</p> <p>- Verify that ASP.NET Errors are not returned to the client. In Sitefinity we do not handle some of the errors with a purpose - Sitefinity is a developer tool, and what speaks best to developers are the error messages that they get. This should not be the case when the application is deployed though - whenever an error occurs, make sure that you display friendly messages and no stack trace or code. The errors can be configured from the <strong>web.config</strong> file:</p> <div style="border: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; "> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">customErrors </span><span style="color: #ff0000;">mode</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"RemoteOnly"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">defaultRedirect</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"FriendlyMessage.htm"</span><span style="font-size: 11px;">&gt;  </span></td> </tr> <tr> <td>      <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">error </span><span style="color: #ff0000;">statusCode</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"404"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">redirect</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"FriendlyNotFoundError.htm"</span><span style="font-size: 11px;">/&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">      <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">error </span><span style="color: #ff0000;">statusCode</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"500"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">redirect</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"FriendlyServerError.htm"</span><span style="font-size: 11px;">/&gt;  </span></td> </tr> <tr> <td>    <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">customErrors</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">system.web</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p>- You can encrypt sensative parts of the web.config file</p> <h2>Server Security</h2> <p>Sometimes the web attacks start with the server being hacked first. Once the attacker has access to your server, he could damage your website. If you have your own server, virtual or physical one, you will have to ensure that the server software is updated, and the firewall is set up correctly.</p> <p><strong>Other good practices:</strong><br /> - ApplicationPool identity user must not have Administrative rights, and must have access only to the web site files rather to the entire server.<br /> - Administration of the CMS could be locked by IP addresses - only the addresses of your content writers/administrators should be in the firewall exlusion list. </p> <p>Resources used for this blog post:</p> <p>MSDN:</p> <ul> <li> <a href="http://msdn.microsoft.com/en-us/library/ms998274.aspx#paght000004_step4" shape="rect">http://msdn.microsoft.com/en-us/library/ms998274.aspx#paght000004_step4</a> </li> <li> <a href="http://msdn.microsoft.com/en-us/library/bb355989.aspx#paght000003_step1" shape="rect">http://msdn.microsoft.com/en-us/library/bb355989.aspx#paght000003_step1</a> </li> <li> <a href="http://support.microsoft.com/kb/910443" shape="rect">http://support.microsoft.com/kb/910443</a> </li> </ul> <p>Wikipedia:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/Cross-site_scripting" shape="rect">http://en.wikipedia.org/wiki/Cross-site_scripting</a> </li> <li><a href="http://en.wikipedia.org/wiki/SQL_injection" shape="rect">http://en.wikipedia.org/wiki/SQL_injection</a> </li> </ul> <p>There is a lot more on the topic, but the right baby steps are usually preventing 99% percents of the problems which might occur later. </p> http://www.sitefinity.com/blogs/georgichokov/posts/10-01-29/building_a_secured_sitefinity_website.aspx Georgi Chokov http://www.sitefinity.com/blogs/georgichokov/posts/10-01-29/building_a_secured_sitefinity_website.aspx 6ec97bc0-e68c-4838-b470-f705039671ff Fri, 29 Jan 2010 16:23:40 GMT Implementing scheduled services in Sitefinity 3.x In this post I will show you how to create scheduled services that could be executed on a certain period of time - hourly, daily, weekly, monthly etc. The post will expose web service that runs a Sitefinity search index. The implementation requires <p>&nbsp;</p> <p>1.Creating a web service in Sitefinity</p> <p>2. Creating a console application that will be used to call the service</p> <p>3. Using Windows Task Scheduler.</p> <p><strong>&nbsp;</strong></p> <p><strong>Creating a web service.</strong></p> <p>&nbsp;</p> <p><img style="width: 600px; height: 400px;" src="http://www.sitefinity.com/Blogs_Libraries/IvanDimitrovLibrary/WebService.sflb.ashx" alt="WebService" /></p> <p><strong></strong></p> <ul> <li>Leave the generated asmx in projet's root.&nbsp;</li> <li>Make sure that the generated class is located in App_Code folder</li> </ul> <p>&nbsp;</p> <p>In the WebMethod I'm adding getting all services using IndexDataManager object. Then I am looping through all indexes and if the name of the index that I am going to pass exists in the&nbsp;IndexingServiceInfo I run the index programmatically using&nbsp;IndexingService object</p> <p>&nbsp;</p> <p> </p> <div style="border: 1px solid #7f9db9; overflow: auto; background-color: white; line-height: 100% ! important; font-family: courier new; font-size: 11px;"> <table cellspacing="0" cellpadding="0" style="border-width: 0px; border-bottom: 0px solid #eeeeee; margin: 2px 0px; width: 99%; border-collapse: collapse; background-color: #ffffff;"> <col style="border-bottom: 1px solid #f7f7f7; font-family: courier new; font-size: 11px; padding-left: 10px; white-space: nowrap;" /> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System.Collections.Generic;&nbsp;</span></td> </tr> <tr> <td><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System.Linq;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System.Web;&nbsp;</span></td> </tr> <tr> <td><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System.Web.Services;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;Telerik.Search;&nbsp;</span></td> </tr> <tr> <td><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;Telerik.Search.Data;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;System.Collections;&nbsp;</span></td> </tr> <tr> <td><span style="color: blue;">using</span><span style="font-size: 11px;">&nbsp;Telerik.Search.Engine;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;</td> </tr> <tr> <td><span style="color: green;">///&nbsp;&lt;summary&gt;&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: green;">///&nbsp;Summary&nbsp;description&nbsp;for&nbsp;IndexingService&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td><span style="color: green;">///&nbsp;&lt;/summary&gt;&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">[WebService(Namespace&nbsp;=&nbsp;<span style="color: blue;">"http://tempuri.org/"</span><span style="font-size: 11px;">)]&nbsp;</span></td> </tr> <tr> <td>[WebServiceBinding(ConformsTo&nbsp;=&nbsp;WsiProfiles.BasicProfile1_1)]&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: green;">//&nbsp;To&nbsp;allow&nbsp;this&nbsp;Web&nbsp;Service&nbsp;to&nbsp;be&nbsp;called&nbsp;from&nbsp;script,&nbsp;using&nbsp;ASP.NET&nbsp;AJAX,&nbsp;uncomment&nbsp;the&nbsp;following&nbsp;line.&nbsp;&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td><span style="color: green;">//&nbsp;[System.Web.Script.Services.ScriptService]&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">public</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">class</span><span style="font-size: 11px;">&nbsp;IndexingService&nbsp;:&nbsp;System.Web.Services.WebService&nbsp;</span></td> </tr> <tr> <td>{&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span><span style="font-size: 11px;">&nbsp;IndexingService()&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">//Uncomment&nbsp;the&nbsp;following&nbsp;line&nbsp;if&nbsp;using&nbsp;designed&nbsp;components&nbsp;&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">//InitializeComponent();&nbsp;&nbsp;</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;[WebMethod]&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">void</span><span style="font-size: 11px;">&nbsp;StartIndex(</span><span style="color: blue;">string</span><span style="font-size: 11px;">&nbsp;indexName)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexDataManager&nbsp;dataManager&nbsp;=&nbsp;<span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;IndexDataManager();&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IList&nbsp;indexes&nbsp;=&nbsp;dataManager.GetServices();&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexingServiceInfo&nbsp;indexServiceInfo&nbsp;=&nbsp;<span style="color: blue;">null</span><span style="font-size: 11px;">;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">foreach</span><span style="font-size: 11px;">&nbsp;(IndexingServiceInfo&nbsp;service&nbsp;</span><span style="color: blue;">in</span><span style="font-size: 11px;">&nbsp;indexes)&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">if</span><span style="font-size: 11px;">&nbsp;(service.Name&nbsp;==&nbsp;indexName)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexServiceInfo&nbsp;=&nbsp;service;&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">break</span><span style="font-size: 11px;">;&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">if</span><span style="font-size: 11px;">&nbsp;(indexServiceInfo&nbsp;!=&nbsp;</span><span style="color: blue;">null</span><span style="font-size: 11px;">)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Telerik.Search.Engine.IndexingService&nbsp;service&nbsp;=&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;Telerik.Search.Engine.IndexingService(indexServiceInfo);&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">int</span><span style="font-size: 11px;">&nbsp;timeout&nbsp;=&nbsp;</span><span style="color: blue;">this</span><span style="font-size: 11px;">.Context.Server.ScriptTimeout;&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span><span style="font-size: 11px;">.Context.Server.ScriptTimeout&nbsp;=&nbsp;4800;&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.Index(<span style="color: blue;">false</span><span style="font-size: 11px;">);&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span><span style="font-size: 11px;">.Context.Server.ScriptTimeout&nbsp;=&nbsp;timeout;&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">else</span><span style="font-size: 11px;">&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">throw</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;ApplicationException(</span><span style="color: blue;">"not&nbsp;found&nbsp;name"</span><span style="font-size: 11px;">);&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td>}&nbsp;</td> </tr> </tbody> </table> </div> <p>. </p> <p>&nbsp;</p> <p><strong>Creating Console Application</strong></p> <ul> <li>Create the console application</li> </ul> <p>&nbsp;<img style="width: 600px; height: 400px;" src="http://www.sitefinity.com/Blogs_Libraries/IvanDimitrovLibrary/ConsoleApplication.sflb.ashx" alt="ConsoleApplication " /></p> <p>&nbsp;</p> <ul> <li>Add Web reference to the WebService that is located in Sitefinity website</li> </ul> <p><img alt="" style="width: 600px; height: 400px;" src="http://www.sitefinity.com/Blogs_Libraries/IvanDimitrovLibrary/WebReference.sflb.ashx" /> </p> <p>&nbsp;</p> <ul> <li>Implement the logic in the console application to call the WebService method, pass the name of the index and finally run it.</li> </ul> <p>&nbsp; </p> <div style="border: 1px solid #7f9db9; overflow: auto; background-color: white; line-height: 100% ! important; font-family: courier new; font-size: 11px;"> <table cellspacing="0" cellpadding="0" style="border-width: 0px; border-bottom: 0px solid #eeeeee; margin: 2px 0px; width: 99%; border-collapse: collapse; background-color: #ffffff;"> <col style="border-bottom: 1px solid #f7f7f7; font-family: courier new; font-size: 11px; padding-left: 10px; white-space: nowrap;" /> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: blue;">namespace</span><span style="font-size: 11px;">&nbsp;IndexConsoleApplication&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">class</span><span style="font-size: 11px;">&nbsp;Program&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">static</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">void</span><span style="font-size: 11px;">&nbsp;Main(</span><span style="color: blue;">string</span><span style="font-size: 11px;">[]&nbsp;args)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StartIndex(<span style="color: blue;">"RunFromConsole"</span><span style="font-size: 11px;">);&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">static</span><span style="font-size: 11px;">&nbsp;</span><span style="color: blue;">void</span><span style="font-size: 11px;">&nbsp;StartIndex(</span><span style="color: blue;">string</span><span style="font-size: 11px;">&nbsp;indexName)&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexingService&nbsp;client&nbsp;=&nbsp;<span style="color: blue;">new</span><span style="font-size: 11px;">&nbsp;IndexingService();&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;client.StartIndex(indexName);&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(<span style="color: blue;">"the&nbsp;website&nbsp;was&nbsp;indexed&nbsp;at"</span><span style="font-size: 11px;">&nbsp;+&nbsp;DateTime.Now.ToUniversalTime().ToString());&nbsp;</span></td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(<span style="color: blue;">"next&nbsp;index&nbsp;is&nbsp;scheduled&nbsp;for"</span><span style="font-size: 11px;">&nbsp;+&nbsp;DateTime.Now.ToUniversalTime().AddDays(1).ToString());&nbsp;</span></td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Read();&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</td> </tr> <tr> <td style="background-color: #f7f7f7;">}&nbsp;&nbsp;</td> </tr> </tbody> </table> </div> <p>&nbsp;</p> <p><strong>Using Windows Task Scheduler</strong></p> <ul> <li>Open My Computer &gt;&gt; Management &gt;&gt; System Tools &gt;&gt; Task Schedler</li> </ul> <p>&nbsp;<img alt="" style="width: 600px; height: 400px;" src="http://www.sitefinity.com/Blogs_Libraries/IvanDimitrovLibrary/TaskScheduler.sflb.ashx" /></p> <ul> <li>&nbsp;Click Create New Task</li> </ul> <p>- <em>Triggers tab</em> - set the time you want to run the index</p> <p>- <em>Actions tab</em> - set the path to the exe generated by the console application.</p> <p></p> <p><strong></strong> </p> <p><img alt="" src="file:///C:/Users/IDIMIT~1/AppData/Local/Temp/2/moz-screenshot.jpg" /></p> http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-01-22/implementing_scheduled_services_in_sitefinity_3_x.aspx Ivan Dimitrov http://www.sitefinity.com/blogs/ivandimitrov/ivanposts/10-01-22/implementing_scheduled_services_in_sitefinity_3_x.aspx 9e606d1b-a48c-4167-b8f9-8dc5fb9896da Fri, 22 Jan 2010 19:52:00 GMT Tabbed blog controls The bellow blog post will guide you how to create a control to display blog authors, blog archive and blog tags in a fashion similar to the one on the <a href="http://www.sitefinity.com/blogs.aspx">Sitefinity Blogs</a>. <p> </p> <p>What we have to do is to create a custom control and a template for this control. This custom control will wrap in the functionality of the existing BloggersList, BlogArchive and TagsList controls. We will use a RadTabStrip control and a RadMultiPage to put each of the first three controls in a different tab. Lets start by creating the template for our control:</p> <p> </p> <div style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-x: auto; overflow-y: auto; background-color: white; line-height: 100% !important; font-family: 'courier new'; font-size: 11px; "> <table cellspacing="0" cellpadding="0" style="border-top-width: 0px; border-right-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: #eeeeee; margin-top: 2px; margin-right: 0px; margin-bottom: 2px; margin-left: 0px; width: 99%; border-collapse: collapse; background-color: #ffffff; "> <col style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #f7f7f7; font-family: 'courier new'; font-size: 11px; padding-left: 10px; white-space: nowrap; " /> <tbody> <tr> <td><span style="font-size: 11px; "></span><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">%@ Control </span><span style="color: red; ">Language</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"C#"</span><span style="font-size: 11px; "> %</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">%@ Register </span><span style="color: red; ">Assembly</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Web.UI"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Namespace</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Web.UI"</span><span style="font-size: 11px; "> </span><span style="color: red; ">TagPrefix</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"telerik"</span><span style="font-size: 11px; "> %</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">%@ Register </span><span style="color: red; ">Assembly</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Blogs"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Namespace</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Blogs.WebControls"</span><span style="font-size: 11px; "> </span><span style="color: red; ">TagPrefix</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"sfWeb"</span><span style="font-size: 11px; "> %</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">%@ Register </span><span style="color: red; ">Assembly</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Cms.Engine"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Namespace</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Telerik.Cms.Engine.WebControls.Tags"</span><span style="font-size: 11px; "> </span><span style="color: red; ">TagPrefix</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"sfWeb"</span><span style="font-size: 11px; "> %</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7; "><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadTabStrip </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"TabStrip1"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Skin</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Vista"</span><span style="font-size: 11px; "> </span><span style="color: red; ">SelectedIndex</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"0"</span><span style="font-size: 11px; "> </span><span style="color: red; ">MultiPageID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"MultiPage1"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">Tabs</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadTab </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Bloggers"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadTab</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadTab </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Archive"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadTab</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadTab </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Tags"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadTab</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">Tabs</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadTabStrip</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "><span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadMultiPage </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"MultiPage1"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">SelectedIndex</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"0"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadPageView </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"BloggersView"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">sfWeb:BloggersList </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"BloggersList1"</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>            <span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">ProviderName</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Blogs"</span><span style="font-size: 11px; ">&gt;     </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">h2</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:Literal </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"controlTitle"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:Literal</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">h2</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: green; ">&lt;!-- bulleted list mode --&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:BulletedList </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"bulletedList"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:BulletedList</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: green; ">&lt;!-- dropdown list mode --&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">p</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;</span><span style="font-weight: bold; color: black; ">telerik</span><span style="font-size: 11px; ">:OptgroupDropDownList </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"dropDownList"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:OptgroupDropDownList</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;/</span><span style="font-weight: bold; color: black; ">p</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">         </span></td> </tr> <tr> <td>        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">sfWeb:BloggersList</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadPageView</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadPageView </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"ArchiveView"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">sfWeb:BlogArchive </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"BlogArchive1"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>            <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: green; ">&lt;!-- bulleted list mode --&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadTreeView </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"archiveTreeView"</span><span style="font-size: 11px; "> </span><span style="color: red; ">ShowLineImages</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"false"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadTreeView</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: green; ">&lt;!-- dropdown list mode --&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">p</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;</span><span style="font-weight: bold; color: black; ">telerik</span><span style="font-size: 11px; ">:OptgroupDropDownList </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"dropDownList"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:OptgroupDropDownList</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;/</span><span style="font-weight: bold; color: black; ">p</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>            <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">sfWeb:BlogArchive</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadPageView</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">telerik:RadPageView </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"TagsView"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">sfWeb:TagsList </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"BlogTagsList1"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">ProviderName</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Blogs"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">p</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:Literal </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"lblDisplayAs"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"Display as"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:Literal</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> : </span></td> </tr> <tr> <td>                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:LinkButton </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"displayCloudLink"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"cloud"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:LinkButton</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> | </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:LinkButton </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"displayListLink"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">Text</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"list"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:LinkButton</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">p</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "> </td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:Repeater </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagsRepeaterCloud"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">HeaderTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;</span><span style="font-weight: bold; color: black; ">ul</span><span style="font-size: 11px; "> </span><span style="color: red; ">class</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagCloud"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">HeaderTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">ItemTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">li</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;</span><span style="font-weight: bold; color: black; ">asp</span><span style="font-size: 11px; ">:HyperLink </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagLink"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; "> </span><span style="color: red; ">CssClass</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagCloudItem"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:HyperLink</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;/</span><span style="font-weight: bold; color: black; ">li</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td>                    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">ItemTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">FooterTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;/</span><span style="font-weight: bold; color: black; ">ul</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">FooterTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:Repeater</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "> </td> </tr> <tr> <td>                <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:Repeater </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagsRepeaterList"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">HeaderTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;</span><span style="font-weight: bold; color: black; ">ul</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">HeaderTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">ItemTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                        <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">li</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                            <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:HyperLink </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"tagLink"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:HyperLink</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                            (<span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">asp:Label </span><span style="color: red; ">ID</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"taggedContentCount"</span><span style="font-size: 11px; "> </span><span style="color: red; ">runat</span><span style="font-size: 11px; ">=</span><span style="color: blue; ">"server"</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:Label</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">) </span></td> </tr> <tr> <td>                        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">li</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">ItemTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>                    <span style="color: blue; ">&lt;</span><span style="font-size: 11px; ">FooterTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; ">&lt;/</span><span style="font-weight: bold; color: black; ">ul</span><span style="font-size: 11px; ">&gt;</span><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">FooterTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">asp:Repeater</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>            <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">LayoutTemplate</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">sfWeb:TagsList</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>    <span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadPageView</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; "><span style="color: blue; ">&lt;/</span><span style="font-size: 11px; ">telerik:RadMultiPage</span><span style="color: blue; ">&gt;</span><span style="font-size: 11px; "> </span></td> </tr> </tbody> </table> </div> <p> </p> On the back-end of the control we do not have to do a lot of coding. We only need to expose a few properties so that we can edit our control setting through the UI of the CMS. We will set the LayoutTemplatePath property to point to the template we have just created, and will expose the BloggersList, BlogArchive, and TagsList control as editable properties: <div style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #7f9db9; border-right-color: #7f9db9; border-bottom-color: #7f9db9; border-left-color: #7f9db9; overflow-x: auto; overflow-y: auto; background-color: white; line-height: 100% !important; font-family: 'courier new'; font-size: 11px; "> <table cellspacing="0" cellpadding="0" style="border-top-width: 0px; border-right-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: #eeeeee; margin-top: 2px; margin-right: 0px; margin-bottom: 2px; margin-left: 0px; width: 99%; border-collapse: collapse; background-color: #ffffff; "> <col style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #f7f7f7; font-family: 'courier new'; font-size: 11px; padding-left: 10px; white-space: nowrap; " /> <tbody> <tr> <td><span style="font-size: 11px; ">    </span><span style="color: blue; ">public</span><span style="font-size: 11px; "> </span><span style="color: blue; ">class</span><span style="font-size: 11px; "> BlogMultiView : SimpleControl </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">    { </td> </tr> <tr> <td><span style="color: gray; ">        #region Public Properties</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        [WebEditor(<span style="color: blue; ">"Telerik.FileManager.UrlWebEditor, Telerik.FileManager"</span><span style="font-size: 11px; ">), Category(</span><span style="color: blue; ">"Appearance"</span><span style="font-size: 11px; ">)] </span></td> </tr> <tr> <td>        <span style="color: blue; ">public</span><span style="font-size: 11px; "> </span><span style="color: blue; ">override</span><span style="font-size: 11px; "> </span><span style="color: blue; ">string</span><span style="font-size: 11px; "> LayoutTemplatePath </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">        { </td> </tr> <tr> <td>            <span style="color: blue; ">get</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            { </td> </tr> <tr> <td>                <span style="color: blue; ">return</span><span style="font-size: 11px; "> </span><span style="color: blue; ">"~/CustomControls/ControlTemplates/BlogMultiView.ascx"</span><span style="font-size: 11px; ">; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            } </td> </tr> <tr> <td>            <span style="color: blue; ">set</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            { </td> </tr> <tr> <td>                <span style="color: blue; ">base</span><span style="font-size: 11px; ">.LayoutTemplatePath = value; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            } </td> </tr> <tr> <td>        } </td> </tr> <tr> <td style="background-color: #f7f7f7; ">        <span style="color: blue; ">public</span><span style="font-size: 11px; "> BloggersList BloggersList </span></td> </tr> <tr> <td>        { </td> </tr> <tr> <td style="background-color: #f7f7f7; ">            <span style="color: blue; ">get</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td>            { </td> </tr> <tr> <td style="background-color: #f7f7f7; ">                <span style="color: blue; ">return</span><span style="font-size: 11px; "> </span><span style="color: blue; ">base</span><span style="font-size: 11px; ">.Container.GetControl&lt;BloggersList&gt;(</span><span style="color: blue; ">"BloggersList1"</span><span style="font-size: 11px; ">, </span><span style="color: blue; ">false</span><span style="font-size: 11px; ">, Telerik.Framework.Web.TraverseMethod.BreadthFirst); </span></td> </tr> <tr> <td>                 </td> </tr> <tr> <td style="background-color: #f7f7f7; ">            } </td> </tr> <tr> <td>            <span style="color: blue; ">set</span><span style="font-size: 11px; "> </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            { </td> </tr> <tr> <td>                <span style="color: blue; ">this</span><span style="font-size: 11px; ">.BloggersList = value; </span></td> </tr> <tr> <td style="background-color: #f7f7f7; ">            } </td> </tr> <tr> <td>