Who knows how to do this???
Publicado por George (2 intervenciones) el 23/10/2005 03:18:01
How do I set cell color (one by one) in a datagrid.
I set the columns (with tablestyles), according to a range of time (dinamically), so, the datagrid is not built by a specific datasource, I mean, I declare a DataTable with 4 defined columns, and the others are made dinamically.
Then, I get some records from the database, and I make a "foreach" sentence to loop trough the records, for each record I made a DataRow and I set the values for "myRow[indexColumn]", after that I add that row to the DataTable that I declared before.
Well, I've been using Events and custom DataGridTextBox in order to solve my problem...but it doesn't work yet, when I declared my DataGridTextBox to a TableSyle, I set a Handler
/********************************************************/
aColAE.MappingName = "ENC";
aColAE.HeaderText = "ENC";
aColAE.Width = 35;
aColAE.Alignment = HorizontalAlignment.Left;
aColAE.NullText = "";
aColAE.TextBox.Enabled = false;
aColAE.ReadOnly = true;
aColAE.DataGridDisableCell += new DataGridDisableCellHandler(SetEnableValues);
/**********************************************************/
and the handle works, in fact, the cell is painted...but applies for all the cells that belongs to a specific column...but I need for a specific cel, depending on some values.
I 've checked this links
http://www.codeproject.com/csharp/Custom_DataGridColumnStyl.asp
http://www.dotnet247.com/247reference/msgs/51/256341.aspx
http://www.akadia.com/services/dotnet_datagrid_disable_cell.html
http://www.syncfusion.com/FAQ/WindowsForms/
I'm very stressed about this...please, if someone knows how to do that, let me know.
Thanks in advance!
I set the columns (with tablestyles), according to a range of time (dinamically), so, the datagrid is not built by a specific datasource, I mean, I declare a DataTable with 4 defined columns, and the others are made dinamically.
Then, I get some records from the database, and I make a "foreach" sentence to loop trough the records, for each record I made a DataRow and I set the values for "myRow[indexColumn]", after that I add that row to the DataTable that I declared before.
Well, I've been using Events and custom DataGridTextBox in order to solve my problem...but it doesn't work yet, when I declared my DataGridTextBox to a TableSyle, I set a Handler
/********************************************************/
aColAE.MappingName = "ENC";
aColAE.HeaderText = "ENC";
aColAE.Width = 35;
aColAE.Alignment = HorizontalAlignment.Left;
aColAE.NullText = "";
aColAE.TextBox.Enabled = false;
aColAE.ReadOnly = true;
aColAE.DataGridDisableCell += new DataGridDisableCellHandler(SetEnableValues);
/**********************************************************/
and the handle works, in fact, the cell is painted...but applies for all the cells that belongs to a specific column...but I need for a specific cel, depending on some values.
I 've checked this links
http://www.codeproject.com/csharp/Custom_DataGridColumnStyl.asp
http://www.dotnet247.com/247reference/msgs/51/256341.aspx
http://www.akadia.com/services/dotnet_datagrid_disable_cell.html
http://www.syncfusion.com/FAQ/WindowsForms/
I'm very stressed about this...please, if someone knows how to do that, let me know.
Thanks in advance!
Valora esta pregunta


0