Anti-forgery Tokens in ASP.NET MVC and Knockout

As I am implementing a small application framework for my current project that is using ASP.NET MVC and Knockout JavaScript library, I had to rethink the approach to using anti forgery tokens.  Any forgery tokens in ASP.NET MVC are designed to prevent cross-site request forgery attacks. Cross site scripting is number 2 on list of …

Continue reading ‘Anti-forgery Tokens in ASP.NET MVC and Knockout’ »

ASP.NET MVC Template and Knockout.js

I am trying to get up to speed with knockout.js.  I am brining it into an MVC application.  I am trying to reduce the amount of JavaScript our team has to write, especially in large, complicated screens.  At the same time, I want to leverage the power of MVC views.  Our application is using DataAnnotations, …

Continue reading ‘ASP.NET MVC Template and Knockout.js’ »

Validating Dependent Fields in ASP.NET MVC

In this post I wanted to describe a solution to a specific problem I recently encountered.  The problem is as following.  I have a class with a set of dependent properties, such as start and end date or minimum / maximum numbers.  I want to implement both client and server side validation in an MVC …

Continue reading ‘Validating Dependent Fields in ASP.NET MVC’ »

More on jqGrid and getRowData function in edit mode

I blogged a while back on shortcoming of getRowData function of jqGrid in edit mode.  I also recently ran into an issue when getRowData was returning blank for a cell that contains select (dropdown) control in edit mode.  So, I wrote a quick function that I wanted to post here to help others that handles …

Continue reading ‘More on jqGrid and getRowData function in edit mode’ »

JqGrid, getRowData and Cells in Edit Mode

Today I was fighting with a very specific problem.  I was working with jqGrid’s getRowData method.  I was implementing batch save feature, where a user can edit some data in the grid, then hit Save button to send the data to the server.  I set up a column (SortOrder) to be always editable to be …

Continue reading ‘JqGrid, getRowData and Cells in Edit Mode’ »

Detecting Pending Changes in ASP.NET MVC

In this blog I am going to describe a pretty common problem that web applications have to deal with along with one way to solve this issue. Here is the issue at hand.  Say, user pulled up an entry form and made some changes.  Then the above mentioned user clicked browser back button, navigating away …

Continue reading ‘Detecting Pending Changes in ASP.NET MVC’ »

jqGrid ajax Operations in ASP.NMET MVC

I am using jqGrid in my current project, and I already blogged prior on how impressed I am with the functionality available in this control.  I am using it in ASP.NET MVC application, but it can be used in any web app.  One of the key features is that it supports ajax based asynchronous server …

Continue reading ‘jqGrid ajax Operations in ASP.NMET MVC’ »

Localizing JavaScript in ASP.NET MVC

This is something I researched recently while working on an ASP.NET MVC application.  My goal was to localize JavaScript messages based on user preferences.  In this post I am going to document the approach I settled on.  I am going to test based on browser culture and also drive the application based on the same …

Continue reading ‘Localizing JavaScript in ASP.NET MVC’ »