Hello,
I'm actually using a databinding, which has a DataTable as Datasource.
This DataTable is a custom version of SQLServer database format, and suit with my grid (every column is link by name with my databinding columns)
My grid has my databinding as datasource.
Actually everything is fine. (see screen1.png attached)
As you can see in screen1.png, there are some checkboxcolumns in my grid, and I would like to move theses columns to a childrow. (screen2.png)
Is there a way to do this programmatically?
I could already add chilrows
Second point:
Since I use the databinding, I can't interfere anymore on the cellformatting event in order to put my datevalue "01/01/0001" to string.empty.
Any solution as wordaround?
Thanks for your lights
Regards
Thanks a lot
I'm actually using a databinding, which has a DataTable as Datasource.
DataTable dataTable =
new
DataTable();
dataTable.Columns.AddRange(
new
DataColumn[]{
new
DataColumn(
"NumeroActe"
,
typeof
(
string
)),
new
DataColumn(
"DateActe"
,
typeof
(
string
)),
new
DataColumn(
"TypeBien"
,
typeof
(
string
)),
new
DataColumn(
"Surface"
,
typeof
(
decimal
)),
new
DataColumn(
"Prix"
,
typeof
(
decimal
)),
new
DataColumn(
"Pieces"
,
typeof
(
int
)),
new
DataColumn(
"EpoqueConstruction"
,
typeof
(
string
)),
new
DataColumn(
"NumeroRue"
,
typeof
(
string
)),
new
DataColumn(
"NomRue"
,
typeof
(
string
)),
new
DataColumn(
"LieuDit"
,
typeof
(
string
)),
new
DataColumn(
"CodePostal"
,
typeof
(
string
)),
new
DataColumn(
"Localite"
,
typeof
(
string
)),
new
DataColumn(
"Maison"
,
typeof
(
bool
)),
new
DataColumn(
"Appartement"
,
typeof
(
bool
)),
new
DataColumn(
"Terrain"
,
typeof
(
bool
)),
new
DataColumn(
"Local"
,
typeof
(
bool
)),
new
DataColumn(
"Annexe"
,
typeof
(
bool
)),
new
DataColumn(
"Cave"
,
typeof
(
bool
)),
new
DataColumn(
"Garage"
,
typeof
(
bool
)),
new
DataColumn(
"Grenier"
,
typeof
(
bool
))
});
dataTable.BeginLoadData();
foreach
(DataRow row
in
table.Rows)
{
// Create a ExportVenteData according to the current Database row
ExportVenteManager manager =
new
ExportVenteManager();
ExportVenteData tmpExportData = manager.BuildExportVenteData(row);
if
(tmpExportData !=
null
&& tmpExportData.IsValid())
{
// Create the new custom line for the datasource
DataRow ligne = dataTable.NewRow();
ligne[
"NumeroActe"
] = tmpExportData.NumActe;
ligne[
"DateActe"
] = tmpExportData.DateActe.ToString(
"dd/MM/yyyy"
);
ligne[
"TypeBien"
] = cTypeFiche.GetLibelle(tmpExportData.TypeBien);
ligne[
"Prix"
] = tmpExportData.PrixVente;
ligne[
"Surface"
] = tmpExportData.Surface;
ligne[
"Pieces"
] = tmpExportData.NbPieces;
ligne[
"EpoqueConstruction"
] = cLibellesEnums.EpoqueConstruction.ToString(tmpExportData.EpoqueConstruction);
ligne[
"NumeroRue"
] = row[
"NUMERO_RUE"
] !=
null
? row[
"NUMERO_RUE"
].ToString() :
""
;
ligne[
"NomRue"
] = row[
"NOM_RUE"
] !=
null
? row[
"NOM_RUE"
].ToString() :
""
;
ligne[
"LieuDit"
] = row[
"LIEU_DIT"
] !=
null
? row[
"LIEU_DIT"
].ToString() :
""
;
ligne[
"CodePostal"
] = row[
"CODE_POSTAL"
] !=
null
? row[
"CODE_POSTAL"
].ToString() :
""
;
ligne[
"Localite"
] = row[
"LOCALITE"
] !=
null
? row[
"LOCALITE"
].ToString() :
""
;
foreach
(eTypeFiche fiche
in
tmpExportData.LstAnnexesSupplementaires)
{
switch
(fiche)
{
case
eTypeFiche.ANNEXE:
ligne[
"Annexe"
] =
true
;
break
;
case
eTypeFiche.ANNEXE_CAVE:
ligne[
"Cave"
] =
true
;
break
;
case
eTypeFiche.ANNEXE_GRENIER:
ligne[
"Grenier"
] =
true
;
break
;
case
eTypeFiche.APPARTEMENT:
ligne[
"Appartement"
] =
true
;
break
;
case
eTypeFiche.GARAGE:
ligne[
"Garage"
] =
true
;
break
;
case
eTypeFiche.LOCAL:
ligne[
"Local"
] =
true
;
break
;
case
eTypeFiche.MAISON:
ligne[
"Maison"
] =
true
;
break
;
case
eTypeFiche.TERRAIN:
ligne[
"Terrain"
] =
true
;
break
;
}
}
dataTable.Rows.Add(ligne);
}
}
dataTable.EndLoadData();
This DataTable is a custom version of SQLServer database format, and suit with my grid (every column is link by name with my databinding columns)
dgvData.MasterTemplate.BeginUpdate();
bdsData.DataSource = _dataTable;
dgvData.MasterTemplate.EndUpdate();
My grid has my databinding as datasource.
Actually everything is fine. (see screen1.png attached)
As you can see in screen1.png, there are some checkboxcolumns in my grid, and I would like to move theses columns to a childrow. (screen2.png)
Is there a way to do this programmatically?
I could already add chilrows
Second point:
Since I use the databinding, I can't interfere anymore on the cellformatting event in order to put my datevalue "01/01/0001" to string.empty.
Any solution as wordaround?
Thanks for your lights
Regards
Thanks a lot