Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1005
CRUD in igGrid without MVC
posted

Hi!

   I want to create a little application with a igGrid control. The data source is an SQL database (in SQL Server). I am not finding an easy way to create just a page showing data in the igGrid and allowing me update data. (I dont need add rows or remove rows, just update some values). I don´t understand how to link the igGrid to SQL server database.

Thanks for your help.

Regards,

Fernando

Parents
No Data
Reply
  • 6279
    Suggested Answer
    posted

    Hi Fernando,

    I presume you are thinking from the perspective of APS.NET WebForms where page controls (like our Aikido data grid for example) has easy access to the server-side and thus they usually had the functionality you're looking for build in (for example: http://ko.infragistics.com/products/aspnet/sample/data-grid/editing-rows-basic-features)

    With MVC aside, our igGrid is a client-side only control which is absolutely independent from the server-side: it can request and post data to an URL and that's it: it doesn't care how that server-side looks like (is it Java with DB2 or C# with MSSQL Server, for example).

    Thus the solution I can recommend is to:
    1. create a WCF service and have a method called "SaveChanges" with the HTTP POST verb.
    2. You can use the URL to that service method for the grid's updateUrl option so that the grid can post all of its changes to it
    3. Take a careful look at the Batcing Updates sample for the igGrid - your "SaveChanges" method will have to look like the "SaveChanges" controller action from that sample
    4. Here's the tricky part: since you will not be using the MVC wrapper for the grid, you will not have access to the LoadTransactions method of the MVC GridModel  so you will need to implement that method yourself.
    5. The good news is that all that method does is to translate the incoming transactions (in JSON format) into the Transaction class. Thus, you can easily use any JSON parser for this purpose and then handle the update to the SQL server database.

    Feel free to let me know if you have any further questions or trouble.

    Cheers,
    Borislav

Children