6 things to check if your Web part is not working in kentico CMS

Source: Internet
Author: User

Original post address: http://www.mcbeev.com/Blog/May-2013/6-Things-to-Check-if-your-Web-Part-is-Not-Working-in-Kentico-CMS

Introduction

Have you ever had your shopping cart Web part not get past step two in the checkout process? Or ever had your logon Form Web part not authenticate correctly. Maybe your comment view Web part doesn't allow you to edit or add a blog post comment?
There is nothing more frustrating to a kentico developer than spending time on a problem that shocould not be a problem.

Most developers that have experience with kentico have probably added hundreds of Web parts to Web Part zones in their careers. 99.9% of the time they just work the way they shocould. however, every once in awhile something goes wrong, and when it
Does, it can be infuriating. I have put together the following list below to hopefully save even the most grizzled kentico veteran some time when it comes to troubleshooting why a Web Part refuses to work the way it shocould.

 

1. Check the Disable View state property on Web parts, Web Part zones and page place holders

The first place to start troubleshooting a Web part that does not work is this property. having the Disable View state checkbox checked cocould be the culprit for the malfunction. view state is a very important property for any ASP. net Control
Work correctly. I mention this frequently that you shouldTurn this checkbox on Optimization
Of read only or listing Web parts
, But don't shoot yourself in the foot when it comes to controls that have postbacks in play. ASP. net user controls that utilize buttons, linkbuttons, dropdowns with autopostback set to true, and even update panels
All require view State to work. view state is the mechanism that persists State contains ss a PostBack so that the ASP. net Framework knows what values the controls have in them. so make sure this is not checked on the Web part, the Web Part zone, and the page placeholder
On your page template if the Web part utilizes a PostBack like the shopping cart Web part does.

2. temporarily disable content inheritance on the page template

The majority of Page Templates in kentico CMS are set to inherit content from the master page only. if you are working through an issue of a Web part or set of web parts not working, one thing to narrow down is if the issue is originating from your
Page Template or the master page template.

On the template sub tab there isInherit contentRadio button list (bottom
Of the screen shot below). change thisDo not inherit any contentTo narrow down if
The problem is within your template of the master page. just remember to change it back to what it was originally set. just don't be shocked when none or just part of your CSS or JS load. this is normal when you are not inherited any content.

3. Check the transformation code

Sometimes the problem is not within the loading of the data into a web part, rather it's how that data is being rendered to the page. this is the job of the transformation. not every single web part utilizes a transformation but for the ones that
Do, especially repeaters, this can be the source of the problem. transformations can contain field names that don't exist in the underlying datasource, they can nest other Web parts and user controls, or they can have raw C # code.

One technique that I use to troubleshoot a transformation is to start commenting out large chunks of the HTML or server side code to try and narrow down which area of the transformation is causing the problem. this is also probably one of the most
Complex items to troubleshoot out of all of the items in this list.

4. Enable debugging in the cmssitemanager

Debugging allows you to see all the things that are happening on a page in kentico even down to the Web Part level. SQL requests are your biggest source of information here. if you are in a pinch you can even watch the debugging information on
Live Site by enabling the debugging info by goingCmssitemanager-> Settings-> Expand system-> debugSettings
Page. Once you have unchecked disable debugging kentico starts tracking just about everything on every page request. After that you can go to cmssitemanager-> Administration-> system-> debug and click onSQL
Queries
Tab on a site. Just make sure that enable Debug on live site is unchecked first and also don't forget to turn it off once you have what you need.

This is very beneficial because the right hand column of the SQL queries tab shows you what Web part or control the SQL call originated from. you can use this so see if the SQL is valid and successful or is erroring right then and there. there is
Also more important and useful information here because the debugger will tell you the number of rows and number of columns returned on each SQL call as well. all good information to have when trying to figure out a problem with a Web part.

5. Check the event log

Yes it seems like a simple one, but almost all except tions are going to be logged to the kentico event log. this shoshould be one of the first places you look to see what information you have on any errors. remember that the best way to view the event
Log is from inside of cmssitemanager. I say this because it shows you global events of your entire kentico instance and not just site specific ones. the Event code column can be a good place to start filtering the event log on. you can filter to just errors
Of code loadwebpart or others. Again useful in troubleshooting kentico problems.

You can click the view action on the left most column to see a full detailed description of the specific event as well.

6. Compare the Web Part properties XML of a page template

Each page template in kentico CMS is stored as a row of data in SQL Server as you wowould perform CT. there is actually a single column used to store what is configured on each of the page templates in the site. this column has an XML Representation
All of the Web Part properties on that template and all of the Web Part's setting values. Basically it is a big dictionary of each Web part on the template.

This data is actually exposed in the cmssitemanager UI for a page template. To see it click on any page template and choose the Page Template and then clickWeb
Parts
Tab. Often when troubleshooting a page that isn't working I will grab this XML and compare it a Dev instance via winmerge or
Some other Visual diff too.

Also as the warning suggests, you shoshould only edit this data if you know exactly what you are doing. it has to be 100% right. however, if you have a good working copy on your QA or Dev instance you take some of the XML from that instance and overwrite
Your destination template if you have.Just be extra careful with this one, With great power comes
Great responsibility.

Conclusion

Well there you have it. I have shown you 6 things to check when your Web part is not working in kentico CMS. these tips apply to all versions of kentico. hopefully one or more of them will save you some heartache next time you have to troubleshoot
A problem in kentico. If you have your own tips feel free to leave them in the comments section on this post.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.