I'm a beginner of C# users.
I'm using the DevExpress with C# Window Form Application.
I'm trying to move data from gridcontrol_1 to gridcontrol_2.
The gridcontrol_1 connected from MSSQL DB TableA.
I want to set DataTable same as gridcontrol_1 into gridcontrol_2. (like shipping cart)
If I select items from gridcontrol_1 then move to gridcontrol_2 by click event.
If I deselect items from gridcontrol_2 then move back to gridcontrol_2 by click event.
Finally, I want to save(insert) the gridcontrol_2 items to the SQL server TableB.
I don't know how to code what I want.
I found a video clip from youtube similarly I want to do.
But, the clip shows only DataGridView Control, not GridControl.
MohamedEidPosted Jun 24, 2024, 5:59 PM
Biggest Thanks for you mister
but i use linq not SqlConnection how to use it with this code
Mayooran NavamanyPosted Jun 23, 2024, 4:31 AM
Step 1: Set up your GridControls
Assuming you have
gridControl1andgridControl2on your form, and both are connected to their respective data sources.Step 2: Load Data into gridControl1
First, you need to load data from
TableAin your SQL Server database intogridControl1.Step 3: Select Rows and Move them to gridControl2
Next, you need to handle the click event to move selected rows from
gridControl1togridControl2.Step 4: Move Rows Back to gridControl1
Similarly, you need to handle the click event to move rows back from
gridControl2togridControl1.Step 5: Save Data from gridControl2 to TableB
Finally, you can save the data from
gridControl2toTableBin your SQL Server database.Step 6: Add Event Handlers
Don't forget to wire up your button click events to the appropriate handlers.
TableAintogridControl1.gridControl1togridControl2.gridControl2togridControl1if needed.gridControl2toTableBin your SQL Server database.By following these steps, you should be able to move data between two DevExpress GridControls and save the data to a SQL Server table.