Posts

Showing posts with the label Kentico 7

Kentico 7 Get Current Date Time using macro

In Kentico 8, you can call the macro method to show date-time information just like C# code which is : {%DateTime.Now%} But for Kentico version 7, you can not call date-time in a macro using the above code. So I have to wonder how to call the date-time using a macro in Kentico 7 and how to format the date-time. Below is a solution to achieve this in Kentico 7. Get Date Time {% CurrentDateTime%} Format Date Time  {% GetDateTime(CurrentDateTime, "MM dd yyyy")%} Hopefully, the above solution helps someone.

How to specify WhereCondition in Transformation - Nested Control - kentico 8, 7, 6

Image
Before this i wonder how to pass some where condition in transformation repeater. So i ask the kentico guys and he give me a solution which i think i can share to the others. So in your transformation you can specify the <script runat="server"></script> element. This is where you can pass the where condition. Let see the example : Transformation Code <cms:queryrepeater id="repItems" ... DelayedLoading="true" ... /> <script runat="server"> protected void Page_PreRender(object sender, EventArgs e) { queryrepeater.WhereCondition= "NodeAliasPath LIKE '"+(string)Eval("NodeAliasPath")+"'"; queryrepeater.ReloadData(true); } </script> Note : queryrepeater dont have DelayedLoading properties, use DataBindByDefault="false" instead. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites

Kentico 7 - Get Specific document information

This post will show how to get specific document information using Transformation In Kentico 7. Note : i have tested this method in kentico 7 only, donno if the other version will work. You can refer this link to create new transformation method Example : You can use this method in your transformation let say you create new repeater and want to show the parent name of the binding document type data. In this scenario, the document type store under different parent node.        public string getDocumentInfo(string documentID, string parentProperties)         {             TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMSContext.CurrentUser);             TreeNode Node = DocumentHelper.GetDocument(Convert.ToInt16(documentID), tree);             if (Node != null)             {                 switch (parentProperties)                 {                     case "NodeID": return Node.NodeID.ToString();                     case "NodeAliasPath": return Node.NodeAli

Control Webpart Visible/Enable using macro in Kentico

Image
Simple post just to show how you can enable or visible the webpart in certain page. This is basically to avoid using many template. You can use only one template that have many webpart, and you can control visible/enable it using macro. Macro Code {% if(NodeAlias == "Search") {    return true; } else {  return false; } %} By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

How to track download file analytics in Kentico 7

Let say you create one Document Type in Kentico CMS, and inside the document type got one field for attachment. So you want to track/count how many time the document download using Web Analytic feature in Kentico. First of all you need to enable the web analytic feature in  Kentico. Follow this link to read more about web analytic in kentico. Here is the solution to track/count download file for a DocumentType Field. A bit of customization is required to track all the downloaded files. The problem is that only CMS.File document type downloads are tracked by default. However, you can change that by going to the file: \CMSPages\GetFile.aspx.cs Within this file, around line 1268 or Find method LogEvent there is the following condition: if (IsLiveSite && (file.FileNode != null) && (file.FileNode.NodeClassName.ToLower() == "cms.file")) You have to alter it to the following one so all files are logged, not only files attached to a CMS.File document: if (IsLiveSite

Create Navigation Using Kentico 7 Repeater Webpart

Image
Kentico CMS for ASP.NET empowers marketers and developers in creating websites without limits. It's the ultimate solution for your website, store, community and on-line marketing initiatives. Today i want to show how you can use Repeater Webpart to create one Navigation. On this post i will more focus on the Transformation . Let say this is your navigation html code : Navigation Html Code <ul class="megamenu">    <li>     <a href="#_" class="megamenu_drop">LEVEL ONE</a>     <div class="dropdown_3columns dropdown_container">       <ul class="dropdown_flyout">         <li class="dropdown_parent">           <a href="#_">LEVEL TWO</a>           <ul class="dropdown_flyout_level">             <li>               <a href="#_">LEVEL THREE</a>             </li>           </ul>         </li>       </ul>