Wednesday, 11 April 2012

Profile not available in Web Application

Using the Web Application project, you are unable to use the intellisense on the Profile class. A workaround has been provided by Joe Wrobel in a post build task.
This post build task is called Web Profile Builder and can be download here.
The simple approach:
  1. Install the package.
  2. Add the following to your .csproj file
    <Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" />
  3. Build project
Joe has a more details in his post on how to use the build task.

Datatables update function shows an Alert Box

When using the jQuery Datatable plugin and jeditable to allow tables to be editable, calling the update function via sUpdateUrl shows an alert box on it's return.
To suppress the alert box, return the same value that was originally passed in.
C# MVC Example:
$('#myDataTable').dataTable().makeEditable({
    sUpdateURL: "/Home/UpdateData"
})

public class HomeController : Controller
{
    public string UpdateData(int id, string value,
                             int? rowId, int? columnPosition,
                             int? columnId, string columnName)
    {
        //Add code to update cell
        return value;
    }
}
Code borrowed from http://code.google.com/p/jquery-datatables-editable/wiki/EditCell