Tuesday, January 17, 2017

Apply Template to Kendo Grid Dynamically

Here is some code which will show you how you can apply template for kendo grid view.

(1) For this post, i assume that you have kendo grid with datasource is already applied and you only need to apply template dynamically.

(2) while initializing kendo grid, give your name of the template like below
rowTemplate: kendo.template($("#template").html()),

your template "template" will be placed at your html view.
- so for this, whenever your page get load it will automatically bind this template for your individual item
- for this view, if you want to show only template not column title then mark "visible:false" or "hidden:true" or both in you columns so it will just hide your column title on top and show only the item template for each item.

(3) to change your template, find event wherever you want to apply another template and in that event apply below code

var _grid = $('#grid').data('kendoGrid');
_grid.options.rowTemplate = kendo.template($("#othertemplate").html());

(4) so, wherever you want to apply another template just find grid and apply template then refresh grid will reflect your grid with new template applied on it.

Thursday, August 11, 2016

Working with Authorize.net using Sandbox Account

Here is the way by which we can work with authorize.net. You can also work with Create New Sandbox and then Login to Sandbox Account. The steps provided here are worked for me and for code implementation, I used "Authorize Credit Card" which worked for me to my Sandbox Account.

Few things that you need to have to work with this is
(1) API Login ID
You will find login id from your account under Login to Sandbox --> Account Menu --> Security Settings --> General Security Settings --> Click on "API Credentials & Keys" link

(2) Transaction Key
You will find this transaction key from your account under Login to Sandbox --> Account Menu --> Security Settings General Security Settings --> Click on "Manage Public Client Key" link

From the same menu Login to Sandbox --> Account Menu --> Security Settings General Security Settings, you can also set
(3) MD5-Hash

(4) Test Mode - While your account is in Test Mode there will be only processing occurred not exact operation will be performed, but to work with live account after testing to charge/authorize your payment it should be in live mode.

Alternatively, you can also set few more things like
(1) Receipt Page :- Used to send payment information with all required information like API Login Id/Transaction Key/Payment information etc.

(2) Response/Receipt URLs :- Used when operation has been completed from Step-(1) and it sends response of the transaction indicating whether it is success/failure of the transaction.

by navigating to Login to Sandbox --> Account Menu --> Transaction Format Settings --> Transaction Response Settings

Set all this stuff to your sandbox account, You will get C# Sample Code as well. In that set required information to the code and set method of payment which you want to do like you can Charge Credit Card, Authorize Credit Card and so on.

Once this configuration and code with your account configuration execute with code provided based on the method(Charge Credit Card, Authorize Credit Card) selected you will find that thing under Login to Sandbox --> Search Menu --> Unsettled Transactions on success of your transaction.

Once you will are success with Sandbox account, for your live account you can check same thing under "Test Mode" account and to check with your actual transaction make it "Live" from "Test" mode.

That's it for the authorize.net implementation.

Thursday, August 4, 2016

Authorize.net Links

Authorize.Net enables merchants to authorize, settle and manage credit card and electronic check transactions via Web sites, retail stores, mail order/telephone order (MOTO) call centers and mobile devices.

Here is some links about the authorize.net.

(1) Authorize.Net Site

(2) Authorize.Net Sample Code

(3) AuthorizeNet/sdk-dotnet

(4) Direct Post Method(DPM)

(5) AuthorizeNet/sdk-dotnet DPM

(6) Authorize.Net - GitHub

(7) FAQs

(8) Transaction Reporting

(9) Authorize.net Environment Setup

(10) API Reference

Here is few more links for Working with Cold Fusion.

(1) Charge Credit Cards using Authorize.net and ColdFusion


(3) Need Help for ColdFusion SessionToken and AIM for Authorize.net

(4) Integration and Testing

Thursday, April 14, 2016

Working Events of Telerik Grid View Windows Controls

Here is some events where you can do some operations while working with telerik gridview.

(1) Cell double click :- You can do some functionality while clicking over cell of the grid item, it could be anything like opening a another form in edit mode or anything.
Private Sub grid_CellDoubleClick(sender As Object, e As EventArgs) Handles grid.CellDoubleClick
'Your code goes here        
End Sub

(2) Row Formatting :- When you want to do some operations on your grid items this event comes to you. for me, on some operation i need to show items color to red, i checked its column value and if it meets requirement make it red else reset value of the.
Private Sub rgdAvailResult_RowFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RowFormattingEventArgs) Handles rgdAvailResult.RowFormatting
    If e.RowElement.RowInfo.Cells("column1").Value Then
       e.RowElement.ForeColor = System.Drawing.Color.Red
       e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local)
    End If
End Sub

(3) View Row Formatting :- for rows related general event to work with different items of the grid. For me, to show filter bar in different color format, i use this event. So, if the item is filterrow then change is color else reset value to original.
Private Sub grid_ViewRowFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RowFormattingEventArgs)
        If TypeOf e.RowElement Is GridFilterRowElement Then
            e.RowElement.BackColor = Color.NavajoWhite
            e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
        End If
    End Sub

So, these are some events which are i found for my resolution. 

Wednesday, April 13, 2016

Export Telerik Windows GridView Control Data to Excel File

Here is some code snippet which will generate excel file of the telerik windows grid view. I assuming that you already bind data to your telerik grid on your windows application form and performing export to excel on any event.

- Declare new save file dialog in which you will enter your file name
Dim saveFileDialog As New System.Windows.Forms.SaveFileDialog()
- Below code snippet filters your file to be saved for xls only
saveFileDialog.Filter = "Excel (*.xls)|*.xls"
If saveFileDialog.ShowDialog() <> DialogResult.OK Then
End If
- Below code snippet checks whether file name has been entered or not
If saveFileDialog.FileName.Equals([String].Empty) Then
    RadMessageBox.Show("Please enter a file name.")
End If
- Below code snippet acceps name you entered and some default entries to generate your file
Dim fileName As String = saveFileDialog.FileName
Dim excelExporter As New ExportToExcelML("GridName")
excelExporter.SummariesExportOption = SummariesOption.ExportAll
excelExporter.SheetMaxRows = ExcelMaxRows._1048576
- Below code snippet asks dialog to open saved file 
Dim dr As DialogResult = RadMessageBox.Show("The data in the grid was exported successfully. Do you want to open the file?", "Export to Excel", MessageBoxButtons.YesNo, RadMessageIcon.Question)
If dr = DialogResult.Yes Then
End If

This way you can export your telerik windows control grid view data to excel file in default format.

Tuesday, April 12, 2016

Add an Item to Context Menu of Telerik Windows Grid View

Here is some code to work with Context Menu of Grid View of Telerik Windows Controls for Windows Forms

How to add an item to context menu of Grid View : To add custom item to context menu of the telerik grid view follow the steps below. For this code, I assume you are using Telerik Grid View for your Windows Forms and you have performed all necessary steps to bind your grid.

- Add an event handler 
AddHandler radGridView1.ContextMenuOpening, AddressOf radGridView1_ContextMenuOpening1

- Create contet menu event
Private Sub radGridView1_ContextMenuOpening1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.ContextMenuOpeningEventArgs)
        Dim menuItemExportToSpreadsheet As RadMenuItem = New RadMenuItem()
        menuItemExportToSpreadsheet.Text = "Export to Spreadsheet"
        AddHandler menuItemExportToSpreadsheet.Click, AddressOf ExportToSpreadsheet

        Dim separator As RadMenuSeparatorItem = New RadMenuSeparatorItem()
    End Sub

- Create click event of the newly added context menu item
Private Sub ExportToSpreadsheet(ByVal sender As Object, ByVal e As System.EventArgs)
'Your code goes here
End Sub

So, after doing this, each time you are on your grid view and you are opening your context menu you will see a new item get added to your context menu named "Expor to Spreadsheet", and on click of this you can perform logic written under its handler. 

This way you can add new menu item under your Telerik Grid Context Menu.

Thursday, October 1, 2015

Working with kendo drag n drop

Here is some code for the working with drag n drop with kendo drag n drop. This is considered that you are already have your application with kendo enabled environment.

(A) HTML - Following code is your html initialization for the drag & drop object
- Drag Object

Drag Me

- Drop Object

Drop Here


(B) Script - Following code is your jquery function for initialization and drag n drop handling
- Drag object Initialization and event handling
    filter: "this:not(.disabled)",
    hint: function () {
        return "
Drop Me

    dragstart: startfuncion,
    dragend: endfunction,
    dragcancel: cancelfunction

- filter : this line of statement is responsible to disable any object during drag n drop so if you have filtered anything it will be get disable on time of drag and once you drop/cancel current operation it will be again enabled.

function startfuncion(e)
 //you can find your current object related information which is being dragged using e.currentTarget

function endfunction(e)
 //you can write your logic after event get end

function cancelfunction(e)
 //you can find your logic for drag cancel

- Drop object initialization and event handling
    dragenter: dropenterfunction,
    dragleave: dropleavefunction,
    drop: dropfunction,
    dragcancel: dropcancelfunction

function dropenterfunction(e)
 //you can find your logic for highlighting when draggable object enters in this region
function dropleavefunction(e)
 //you can find your logic for remove highlighting when draggable object leaves this region
function dropfunction(e)
 //you can find your logic for object which is dropped to this region
function dropcancelfunction(e)
 //you can find your logic for object which is dragged but was cancelled

Below is link for the kendo drag n drop demo and documentation for same
(1) Demo for Drag & Drop Component in Kendo UI jQuery framework

(2) Overview of DOM element Draggable functionality | Kendo UI Docs

Thursday, May 7, 2015

Working with Export to PDF in Kendo Grid

Here is some link to work with export to PDF in kendo grid

(A) PDF Export Demo: Export to PDF demo and documentation link 
(1) Grid / Export to PDF

(2) Walkthrough of the Grid Features and Behavior

(B) Kendo UI Export Options with Customizations: Export to PDF functionality in two different way you want to manipulate
(1) Kendo UI Drawing API Export functionality - Document Export

(2) Kendo UI PDF Export customizations - Page Layout

(C) Kendo Grid Export to PDF: Export to PDF with launcher which lets user to ask user if we export then it will ask user with open/save dialog
(1) Kendo UI Grid Export to Excel / PDF not working on IE9

(2) Kendo Grid Configuration for Export

Friday, January 9, 2015