Devexpress
How to hide a line in “gridControl1” and show this line in “gridControl2” if the user changes the value of the field?
Theme update
https://www.c-sharpcorner.com/Forums/how-to-make-the-user-disappear-in-gridcontrol1-when-the-us
Scenario:
- User. Changes in gridControl1 in any line the value "???"("on") to the value "????"("off");
- Code. Hides the line in gridControl1 and displays the line in gridControl2;
I tried this using DataView, but it does not work.
How to make the scenario work?
- public partial class Frm13UC : UserControl
- {
- ConectDB conectDB;
- public Frm13UC()
- {
- InitializeComponent();
- }
- private void Frm12_Load(object sender, EventArgs e)
- {
- // ???????????
- conectDB = new ConectDB();
- }
- public void FillGrid_1()
- {
- conectDB.connect();
- gridControl1.DataSource = conectDB.dv1;
- gridView1.BestFitColumns();
- }
- public void FillGrid_2()
- {
- conectDB.connect();
- gridControl2.DataSource = conectDB.dv2;
- gridView2.BestFitColumns();
- }
- }
- public class ConectDB
- {
- public DataTable dt;
- static OleDbDataAdapter adapter;
- static OleDbCommandBuilder cmdBuilder;
- static GridControl gridControlThis;
- public DataView dv1;
- public DataView dv2;
- public ConectDB()
- {
- }
- public void connect()
- {
- string catBD = @"c:\vs\csharp\Db.accdb";
- string conBD = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", catBD);
- OleDbConnection connection = new OleDbConnection(conBD);
- connection.Open();
- string query1 = "SELECT * FROM TableGrid_00";
- OleDbCommand cmd1 = new OleDbCommand(query1, connection);
- dt = new DataTable();
- try
- {
- adapter = new OleDbDataAdapter(cmd1);
- cmdBuilder = new OleDbCommandBuilder(adapter);
- adapter.UpdateCommand = cmdBuilder.GetUpdateCommand();
- adapter.InsertCommand = cmdBuilder.GetInsertCommand();
- }
- catch (Exception ex)
- {
- string s = ex.Message;
- throw;
- }
- adapter.Fill(dt);
- dv1 = new DataView(dt);
- dv1.RowFilter = "groupWork = '???'"; // "on"
- dv2 = new DataView(dt);
- dv2.RowFilter = "groupWork = '????'"; // "off"
- }
- }
Replies
Know the answer? Post it — somebody with the same question will find it here.