Code Snippets

Code: Kendo Combobox with Angular in MVC

As you see the below snippet, the element is same as Select with the different pre-defined attributes for kendo and Angular.
kendo-combo-box – Defines the kendo combobox to be displayed on the UI.
k-data-text-field – Defines the text value for the combo box data.
k-data-value-field – Defines the value field for the combo box data.
k-filter – As we know in combo box, we can take user input for few letters and then the data source gets filtered.

ng-disabled – Angular attribute to disable the combo box on first load.
k-auto-bind – Defines the property auto bind for the data source of combo box.
k-min-length – Defines the minimum characters to be input to auto complete the filter.
k-ng-model – Here instead of normal Angular attribute, ng-model, k-ng-model is used in order to set the kendo combo box model property. This by default takes the k-data-value-field.
k-on-change – This function is triggered when the change event is fired. Instead of ng-change which by default will require ng-model attribute, we use k-on-change.
Hope this simple snippet comes in handy for developers using kendo and Angular. Similar can be used for Kendo Drop down list as well.

Code:Customizing scrolling on an HTML Page

This simple code snippet helps you customize the scrolling event on your HTML web page. It tracks each scroll.
This would be very handy when designing a single page application.
Now-a-days when user scrolls on the Single page application, the navigation link changes class and displays the user.
Use the snippet and let me know:

The second snippet helps you detect the ID clicked and then help you toggle the active class for the nav link clicked. We need to add data-target on the HTML element in order to track the click and animate the User to the selected div on click.

Hope this helps.

Code:Select Insert using Stored Procedure

This snippet is a query which does select Insert operation into a table. We here would see that creating a Stored procedure which actually selects the data from a table and may be insert into the same table or other tables with identical columns. here I would show you how to insert into the same table.

This is really handy when there is a huge amount of records to be selected and inserted and using foreach in Entity Framework would hamper the performance heavily.

Code:PDF generation using Rotativa with response

This code snippet using the Controller Context Response to view the PDF file in another window without downloading it or showing in the same window. Below is the snippet:

Simple Loop Program

A very simple looping program for beginners as well as for QAs who are into script writing for Automation. I have created in dot net fiddle. Please find the link as well. This is a simple program which loops through from 1 to 100 and dispays out put as:

Processing 1 …
1 is a prime Number
1 is an odd number

Processing 2 …
2 is a prime Number
2 is an even number

Processing 3 …
3 is a prime Number
3 is an odd number …

And so on.

So the code goes as below: