Building K2 Smartform Control – Part 2

Continuing from the previous post on building a custom control, visit Part 1 here.

We are going to add a sidemenu javascript library to the K2 Smartform Control.

I have chosen the following javascript library, you can download it from here.

Add Javascript Library to Solution

Now lets add those library to the solution project.

6. Adding the javascript and CSS library

 

Open up the property windows of those files and set them to “Embedded Resources”

7. Setting the properties to Embbedded Resources

NOTE: This is critical for the K2 SmartForm Control, as this will tell the solution to compile the library along with it.

Linking the Javascript Libraries & CSS in the source code

In the SideMenu_Control.cs, open it up and add the following lines of codes.

8. Adding CSS library to Control source file

 

9. Adding JS library to source file

 

We are not done yet, the above codes only tells to K2 Smartfrom Custom Control that those are required resources.

We are going to add those following JS and CSS to the code base with the following lines.

9.1 Adding JS library to source file

Housekeeping

You will notice that the K2 Smartform Custom Control Template generate a whole bunch of codes for you. In this section, we going to remove some stuff to keep it clean.

SideMenu_Control.cs

Remove the following sections that is generated along with the template.

section 1:

 

10. Remove the Generated Method

section 2:

11. Remove the Generated Method 2

section 3:

12. Remove input type as this not a input control

With that all done, we have a clean baseline to work with.

Go to K2 Smartform Custom Control – Part 3

 

Leave a Reply

Your email address will not be published.