How to Develop Custom Web Parts in Kentico

Question :- How to Develop Custom Web Parts in Kentico?

Answer :-     To create/develop custom web parts in Kentico you need to use visual studio to add ASP.NET controls and corresponding write codes for the functionality. To create/develop you need to use kentico APIs that is provided in Kentico Solutions once download and install the Kentico.To create/develop custom APIs you must have knowledge of ASP.NET and SQL SERVER Database Objects.
Here are steps
1.Open the Kentico solution file which will at \inetpub\wwwroot\Kentico\website.sln.

2.In Solution explorer Right click CMSWebParts and choose add new folder .Rename this folder as per our web Part name.for example ABCWebPart.

3.Select ABCWebPart folder and add user control and name it accordingly.Exameple :-Test.ascx

4.Go to design section of user control and set full path of codefile attributes of Control directory. For example in this case it is “~/CMSWebParts/ABCWebPart/Test.ascx.cs.

5.Put the design of the web part whatever you want to add on design.

6.Go to the code behind and add namespace CMS.PortControls and CMS.Helpers,Replace inherit class (System.web.UI,.ontrols) with CMSAbstractWebPart.

7.Write code for each event of the controls as per the requirement. Now build the solution and register the new created web part in Kentico CMS for use.

8.Press F5 and login to Kentico CMS Application through Administrator account.

9.Go to Smart Search and type Web parts Application .Select the Web Part Application and it redirect to Web part application page.Which is divided into two section left and right .

10.Select All web parts root node and Create new category by click on … button (right side of New web part on left top).

11.In New Category page input the Name of Category of web part and save it.New category added to the web part tree.

12.Select the Category and click on New web part button it will redirect to the Create new web part. There are three input fields in this page like display name of web part, code name of web part (Disabled by default) and file path of web part and one checkbox for generate code files for web parts by default it is checked.

13.Input name and file path here it should be “~/CMSWebParts/ABCWebPart/Test.acsx” and uncheck generate code files and click on save button.

You can create properties and set CSS . Now the newly created web parts registered in Kentico for the use. To use it go the page application and select document and go to design tab and then go to webpartzone and click on nav icon and select “add new web part” it will open the web parts list then select and add it to web part zone of page.

Comments

Popular posts from this blog

OutSystems – A Low-code Development Platform

What is difference between Azure Cognitive Search and Elastic Search

failed to access iis metabase asp.net