Tuesday, January 27, 2009

Integrating Asp.net with Ext js



Today, I wrote a sample program using Ext-js on the client side and asp.net on the server side. This sample program has a form with a textbox and combo box and the items in the combo box are loaded from the database (Department table of the adventure works). This should be pretty much simple task for those who have been using Ext js. But it took me couple of hours to get Ext js config objects.
When you have to send object to the client, you can either serialize in the json or xml. Here in my sample program, I used json formatted data. For converting the .net objects into json, I had to use the codes from this site http://james.newtonking.com/projects/json-net.aspx (http://www.codeplex.com/json/) because .net framework doesn’t have json serializer.
Steps:

  • I created a project- web application extjs and added “linq to sql” item in the project(adventureworks.dbml) and added department table into the design surface.

  • In code-behind of default.aspx page, I wrote these codes.
    I couldn't upload the code file. I will upload it later.

  • In default.aspx I wrote ext js codes.
    I couldn't upload the code file. I will upload it later.

  • Then got the output.


No comments: