Posted 10 September 2017, 11:44 am ESTI am using a SQL Data source and binding that to the C1GridView. I have added the command buttons for edit, update, cancel, and delete. How do I get the changes made to reflect in the database and refreshed into the grid? I saw the demo using a different method, but I do not want to use that method.
C1GridView Edit Rows
Posted by: raibeart on 10 September 2017, 11:44 am EST
Replied 10 September 2017, 11:44 am ESTOnce connected to an SQLDataSource, you have to make sure to configure it to generate Insert, Update and Delete statements.
Attached is an image showing this. After doing this your update commend will save the record back to your SQLDataSource.
Hope this helps...
Replied 10 September 2017, 11:44 am ESTAre you binding C1GridView to the data source at Design time or at Run time?
Also, which C1GridView are you using? The C1GridView for Ajax or C1GridView Wijmo and which version.
Which method are you referring to that you do not want to use?
Replied 10 September 2017, 11:44 am ESTBinding at design time.
Wijimo C1GridView (latest version)
In the only sample that I could find, datatables were used.
In more detail...
I want the command buttons to show. I can get them. When I click on "Edit" or "Select", I want to be able to edit in the grid, or in some other instances, in a detailform control (for Select), depending on the complexity of the data being edited.
When I click on "Update" in the command buttons of the grid, I want the record to save back to the SQLDataSource. I have the "Insert" working in the DetailForm. I did it that was since the only sample I saw for adding a record had you reaching behind your back to scratch your elbow. In other words, I could not easily add a record within the grid.
The only "sample" that I found using SQLDataSource was just a Master/Detail using a Grid and a DetailForm.
Replied 10 September 2017, 11:44 am ESTDuh!!!! Of course I did that. Read the issue. It is about the client side coding to get the Edit, Update, and delete to actually work, and not the configuration of the sqldatasource.
Replied 10 September 2017, 11:44 am EST>How do I get the changes made to reflect in the database and refreshed into the grid?
No client side coding is needed to reflect changes in the database and refresh the grid. This is assuming you are using AutoGenerateEditButton="True", AutoGenerateSelectButton="True", AutoGenerateDeleteButton="True" . Please let me know if there is any other customization involved at all. Also, could you please give us the specific version (ex: 4.0.20113.47) you are using and the name of the sample you are referring to?
Replied 10 September 2017, 11:44 am ESTI think that the "trick" is to use the configuration tool. I found this with the Silverlight controls. There are things you simply cannot do because you do not know what to do. The configuration tool does a lot for you. I will try that later tonight.
So, if I change the Delete command text in the SQLDataSource to "UPDATE TableName SET IsDeleted = 1, AuditDeleteDate = '3/1/2012' WHERE PKID = @PKID", it will follow that logic instead of an actual delete?
Replied 10 September 2017, 11:44 am ESTYes you could follow the logic similarly. If I had a IsDeleted field, my Delete would update would be:
DeleteCommand="UPDATE [TableName] SET [IsDeleted] = 1 WHERE [PKID] = @PKID"