Tuesday, July 7, 2015

Wednesday, June 17, 2015

Glass Editable method not working properly in a loop without a model being explicitly passed to it


Glass documentation states that there are two ways to use the Editable method on Webforms.


<%= Editable(Model, x => x.Title) %>  //explicitly stating the model
    <%= Editable(x => x.Title) %> //using the Model property 

What I noticed is that the second one only works outside of the loop. For example, if I am on a detail page for an article and I need to render the title. But if I am in a foreach to display the article's three authors it displays the same data three times and it happens to be the data for the last item in the collection.

What I needed to do was to use the first method where the Model is explicitly passed. 



Tuesday, May 26, 2015

Control with no placeholder listed still renders on the page


Do not be alarmed! Even though I was when I started working on a bug for a client and looked at the Presentation Details on a Sitecore item that had a control with no placeholder. But when I took the control off the page content was gone. Conclusion was obvious - it was THAT very control that made certain things happen on the page. But how was it "attached" if there is no placeholder it goes into?





It was actually listed in the Placeholder field in the Data section on the sublayout item itself.



This is convenient and dangerous at the same time. Convenient because anywhere this control is used it would "know" to be placed in the same placeholder. Dangerous because you might intend to use a different placeholder but the same control in various places on the site.

Monday, May 18, 2015

Extra html tags breaking the page in WFFM 2.3

We all pay attention to a little red asterisk that means "field is required". But once in a while when the form is large or you are not paying attention it takes a couple of attempts to fill everything out correctly. And that's when the page breaks if you are filling out a checkbox list field on a WFFM form.

Suppose I have a form similar to this:


If I pick at least one option under Sample Options checkboxlist and leave of the required fields blank (i.e.City) and click Submit I would get a typical "required field" error. But if I click Submit again and leave any required field blank one more time I get the following exception:


This happens due to the code in Sitecore.Form.Web.UI.Controls.ListControl class inside assembly Sitecore.Forms.Custom, Version=2.3.0.0.


I made a custom class that overwrites the ListControl and doesn't have those tags in it. And the CheckboxList, also a custom one, inherits from it. This bug is fixed in the next version of WFFM (2.4).

Tuesday, April 28, 2015

Naming things right. Sitecore MVC with Glass.

I  have recently encountered a problem with Glass RenderLink method. Idea was simple. I had a template with a General Link field which I intended to render in a View. But the method did not work. No exceptions thrown, simply no rendering happening. After some digging around I noticed that in the codegen Glass file, in the interface that inherits from IGlassBase, the type of the field was incorrect. Instead of being


I was a custom project-specific one, name exactly what the template was named - "Link"


This template name "Link" is what caused the problem. Being so generic it caused Glass to assume it was a project custom type. Once the template was renamed (name should not be so generic) the field type was correct and the RenderLink method worked fine.


Monday, February 9, 2015

Opening PDF files on Windows 8.1


For some unknown reason I was having a hard time opening PDF files on my machine (Windows 8.1).




I updated the Reader, I restarted my machine - in other words tried all the simple things that would come to mind. After some googling around I found out that there is a service that needs to be running to make that happen - Remote Procedure Call (RPC) locator. It should be listed as manual and it should be running. Mine wasn't. Turned it on. Problem solved.



I am not fully sure how RPC is related to PDF's but it is possible that there are issues with application compatibility.

Saturday, January 3, 2015

THINK BIG Sitecore 8 Mongo DB.

The time has come to start experimenting with Sitecore 8 and its powerful Analytics. Download is available here: https://dev.sitecore.net/en/Downloads/Sitecore_Experience_Platform/8_0/Sitecore_Experience_Platform_8_0.aspx

Since I chose to use SIM to install it I had to rename the zip file to "sitecore 8.0 rev. 141212"

I was particularly interested in Experience Profile where I can obtain a wealth of information about a specific visitor: their goals met, their score, value per visit, pages visited, etc, etc, etc. My assumption was that there would be some out of the box visitor information, at least a list of visitors. But the list was blank. The problem was that to use any Sitecore analytics I had to wire up the Mongo DB first.

Instructions I followed came from


There was a problem I encountered with installation.




Because I was only testing it on my local environment I could skip several steps in the process, such as moving the Mongo DB folder to another location or setting it up as a service. Setting up as a service allows automatic start of the Mongo DB when I power up my machine. But if you don't mind manually running the exe file then it's not an issue. The connection strings were set up automatically which was a bonus. 

The next step was to install MongoVue (http://www.mongovue.com/) It allows visualization into the database after you add a connection. 


I set a simple goal (home page visit event) and went to the site in the browser. The next step is going to Sitecore dashboard and click on Experience Profile. From there you can navigate to any visitor (provided there are some).



The overview tab on a visitor detail page is where achieved goals are listed (under Latest Events). 



One more thing. I needed set the session timeout to 1 min instead of the default 20 minutes in the web config file. Otherwise I'd have to wait for 20 minutes for analytics data to be reflected in the profile. 

<sesstionState mode="InProc" cookieless="false" timeout="1">