I am using a WebDataGrid with an SQL data source including CRUD stored procedures.
SELECT procedure loads data correctly, however the WebGrid is excluding the ability
to use CUD.
After viewing multiple videos and reading multiple articles I thought I would be good to go. Unfortunately, this isn’t occurring. Consequent I’m looking to the Forum for help.
Here are links to my source code which may help in resolving my problem.
software.snapcracklepop.net/WebDataGrid.jpg
software.snapcracklepop.net/GridCRUDaspx.txt
software.snapcracklepop.net/GridCRUDcs.txt
Many thanks.
Hello,
Thank you for contacting Infragistics!
I created a sample to test this behavior and have been unable to reproduce this behavior. I use version 16.1.20161.1000. Please run the sample and let me know what behavior you see. Please attach your own isolated sample or modify my sample to reproduce the behavior so I may investigate this matter further.
Running WDG_SQLDataSource reacted exactly as my WDG. SELECT filled the grid but unable to execute CUD stored procedures. Please attached screenshot.
Thank you for the update. I am attaching two samples. One demonstrates creating a grid in the code behind. The second demonstrates doing manual CURD operations and uses the server side events of the grid to update the datasource.
Thanks for your follow up. Most helpful.
I'm going to build a code behind framework over the next few days. I'll keep you updated.
Is this "Your 30-day free trial of ASP.NET priority support will end on 8/31/2017" applicable to your support?
Thank you for the update. Yes the 30-day free trail of priority support applies to both the forums here as well as creating a case through our case system:
https://www.infragistics.com/my-account/support-activity
I have extensive WinGrid experience and transitioning to WebDataGrid is thought-provoking.
Both WebGrid examples WDG_Code and WDG_BatchUpdating you provided seem fragmented and beyond displaying data in the grid CUD functionality is lacking.
Using VS 2013 and Infragistics 16.2 to step through the C# code there appears attempts to invoke CUD but there isn’t any interactive continuity. Just blocks of independent functions.
There is potentially workable code in both programs but I can’t put it together.
Preferably, I would like to do row updating but I’d settle for batch updating. This should be a slam dunk solution even with extensive code behind editing.
In a few months [1/2018] I’ll be using igGrid but right now ASP.Net/WebDataGrid is in play.
If there any additional help you can provide it would be appreciated.
Thank you.
Batch updating and row updating are not mutually exclusive. Batch updating is when all the changes you make (updating cell/row values, adding new rows, or deleting rows) are all kept on the client until a postback is triggered, typically by a save button. When batch updating is set to false provided the proper auto postback flags are set a postback will occur for each change made.
For row updating that is merely the mode in which updating values in the grid is performed. Other methods include cell updating, and a row edit template dialog.
When you saying the grid is lacking in CUD functionality what do you mean? The batch updating sample I sent you has row updating and row adding enabled you have to double click on the row or the AddNewRow to enter edit mode. I am attaching an updated able with row deleting enabled as well. The server side event which I believe you refer to as the “independent function” are there to update the datasource. When you connect to a DataTable or DataSet you are responsible for updating the datasource with the changes made and that particular datasource does not support AutoCRUD.
Cannot Create, Update, or Delete from sample WebGrid.
software.snapcracklepop.net/WebGridError.png
The error you are getting is because you are adding a row with an EmployeeID of “0” when there is already a record/row with the EmployeeID of “0”. EmployeeID is set as the DataKeyField/PrimaryKey which means it requires a unique value be set to that field otherwise you will get an error. When I run my sample I am able to add, updating, and delete without issue.
Looking at the attached WebGrid graphic { http://software.snapcracklepop.net/WebGridAdd.png} how would a user know how to add/insert a new record?
Regarding your last answer to duplicate key, a simple 'If' statement can prevent an execution error.
Hello Hakeem,
Concerning the AddNewRow you have a couple options, you can applying your own custom CSS classes to make it stand out more. You can also enable RowSelectors which will add a plus image to the left of the AddNewRow to indicate a row can be added by using the AddNewRow.
Concerning duplicate keys, it is your responsibility to validate your data and the data your users enter. The reason for this is your DataKeyField could be of varying type such as integer or string, and could have a custom way you want that set so it is unique. You can handle this a couple ways, first by handling the RowAdding client side EnteringEditMode event you can set the value through code to be a valid value and in the grid settings make that column read only:https://www.infragistics.com/help/aspnet/infragistics.web~infragistics.web.ui.gridcontrols.editableclientevents~enteringeditmode
Alternatively you could handle the RowAdding client side ExitingEditMode event and look at the value and if it is invalid change it or cancel the event and make the user change it:https://www.infragistics.com/help/aspnet/infragistics.web~infragistics.web.ui.gridcontrols.editableclientevents~exitingeditmode