Switching to Precompiled a website - custom Webpart code now errors?

Tom Wisneski asked on March 24, 2021 16:02

Our company is switching from website (codefile) to precompiled (codebehind), on Kentico 11. We had custom webparts, one being cloned from Kentico's DocumentsDataSource.ascx.cs file. However in the precompiled cloned version, the code-behind file has erros on its "srcDocuments" control value. So on the previous non-precompiled version the value was; CMS.DocumentEngine.Web.UI.CMSDocumentDataSource.CMSWebParts_Datasources_ DocumentsDataSoruce.srcDocuments.
However now on the precompiled version, when hovered on srcDocuments, message is that "the name does not exist in current context." Not sure how to fix. Can possibly rework custom code. However finding another issue which is the use of hidden fields in a precompiled version. These also error out.

So my questions are actually, can a Kentico built in value like "srcDocuments" be used in a precompiled version? Also, can hidden fields used to pass data to the view (or ascx file) be used in a precompiled Kentico site?

Correct Answer

Tom Wisneski answered on March 25, 2021 16:10

Thank you both for responding. This was an issue of our own setup. I don't wish to waist anyone's time, likewise not wasting my own time. I appreciated the answers. Again...this was an issue of our environment. We now have it working. Thanks! :)

0 votesVote for this answer Unmark Correct answer

Recent Answers

Dmitry Bastron answered on March 24, 2021 19:00

Hi Tom,

I think the first issue should be easily resolved by adding appropriate @using lines to the top of your ascx file, these 2 if I'm not mistaken:

<%@ Control Language="C#" Inherits="CMS.PortalEngine.Web.UI.CMSAbstractLayout" %>
<%@ Register Assembly="CMS.PortalEngine.Web.UI" Namespace="CMS.PortalEngine.Web.UI" TagPrefix="cms" %>
1 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 25, 2021 05:56

I would maybe recommend installing a fresh version of Kentico 11 and use the option to install web application project type and them use as much code files as possible from the fresh instance and also merge your customization into the fresh files. I have seen so many issues when converting web site project to web application, that it was faster in majority of cases to install fresh version and just merge the customization to the new web application project.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.