1
In a certain register screen, I have a GridView
with a few blank lines, then the user would have to type the information in those lines, and then when clicking the save button, do the INSERT
at the bank.
How would you do when the cell loses focus add value to a DataTable
? I know there’s an event LostFocus
but this event is activated when the GridView
loses Focus? Or when the cell loses Focus?
To create the columns of GridView
I’m doing like this:
if (id_crm == 0)
{
DataTable dat_itens = new DataTable();
dat_itens.Columns.Add("ITEM", typeof(int));
dat_itens.Columns.Add("DESCRIÇÃO", typeof(string));
dat_itens.Columns.Add("DESCRIÇÃO NF", typeof(string));
dat_itens.Columns.Add("QUANTIDADE", typeof(int));
for (int i = 1; i < 10; i++)
{
DataRow tablerow = dat_itens.NewRow();
tablerow["ITEM"] = i;
dat_itens.Rows.Add(tablerow);
}
gridControl1.DataSource = dat_itens;
}
Example:
Why you have to add the value to a Datatable?
– Marco Souza
It doesn’t have to be a datatable, it can be a list, a dicitionaty, any way you can make an insert in the database
– Thomas Erich Pimentel
And can’t be straight from your grid? The information is all there in table form just go through - there and recover the data 5
– Marco Souza
Hum.. I walk the grid with a data.Reader?
– Thomas Erich Pimentel
Can you post how you are trying to save your data? the part that is on your button, and the tables that you are using. I believe you have a CRM table and an item table, post this to better understand how you could do. This question has an example of how you can traverse your grid.
– Marco Souza
So, I haven’t even started programming the save button yet. I’ll read this question you sent me, and today I try to make the save button, and put it here. thank you.
– Thomas Erich Pimentel
Managed to solve your problem?
– Marco Souza
Perfect. Really what I needed
– Thomas Erich Pimentel