User (Old forums)MemberJune 19, 2007 at 5:25 pmPost count: 23064
I know absolutely nothing about creating handlers only how to use them. So with that in mind, can someone help me construct a handler (and where the code needs to be placed inside my form) that will allow me to:
Execute a Database update and a DataSet Acceptchanges whenever a value is changed inside either a Master Grid, or detail grid?
I know I need to use the Cell.ValueChanged event but I can’t ever get to it or find it.
master Gridcontrol is named Grid
detailgrid(0) is named detail which is the master of detail2
detailgrid(1) is named detail2
I can get to the cells from the master but can never figure out how to get to the cells in either of the detail grids.
The tutorials for Xceed grids only do the easy stuff that I understand it’s when things get more complex that I can’t find any info on how it must be accomplished.
Imported from legacy forums. Posted by Greg (had 3858 views)User (Old forums)MemberJune 20, 2007 at 10:47 amPost count: 23064
Are you using C# or VB.NET?
Imported from legacy forums. Posted by André (had 294 views)User (Old forums)MemberJune 20, 2007 at 1:11 pmPost count: 23064
Oh, sorry. VB.NET thanks
Imported from legacy forums. Posted by Greg (had 472 views)User (Old forums)MemberJune 21, 2007 at 11:31 amPost count: 23064
Here is a code snippet that shows a very basic implementation of this, and is certainly not recommended with large datasets. It is only an illustration, so you can get you going when using events and DB objects.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘the binding can be done in the designer
GridControl1.SetDataBinding( DataSet11.Customers, “” )
detailGridTemplate1.SetDataBinding( DataSet11.Customers, “CustomersOrders” )
detailGridTemplate2.SetDataBinding( DataSet11.Customers, “CustomersOrders.OrdersOrder_x0020_Details” )
For Each cell As Cell In dataRowTemplate1.Cells
AddHandler cell.ValueChanged, AddressOf cell_ValueChanged
Private Sub cell_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
‘this updates the DB
Imported from legacy forums. Posted by André (had 229 views)User (Old forums)MemberJune 21, 2007 at 11:49 amPost count: 23064
thank you. The part that I was missing and couldn’t figure out was the For Each cell as cell in dataRowTemplate1.Cells snippet.
I wanted to keep going to detailgrids(0) and couldn’t ever get what I needed.
Imported from legacy forums. Posted by Greg (had 385 views)User (Old forums)MemberJune 21, 2007 at 12:52 pmPost count: 23064
Of course, you will need to do the same for every DataRowTemplate, since the grid adds one every time you add a DetailGridTemplate (that is, each DetailGridTemplate has its own DataRowTemplate).
Imported from legacy forums. Posted by André (had 4982 views)
- You must be logged in to reply to this topic.