1
I have a method that triggers a "Bandedgridview" :
private void popula_retContrato(string contrato)
{
Classes.Datatable.Datatable_cliContrato dat_contrato = new Classes.Datatable.Datatable_cliContrato();
gridControl4.Visible = true;
DataSet set = new DataSet();
set = dat_contrato.contrato_set(contrato);
gridControl4.DataSource = set.Tables["contratos"];
gridControl4.ForceInitialize();
GridBand tag = new GridBand() { Caption = "Sumário" };
BandedGridView bandgridview4 = new BandedGridView(gridControl4);
bandgridview4.Bands.Add(tag);
gridControl4.LevelTree.Nodes.Add("relator", bandgridview4);
bandgridview4.ViewCaption = "Relatórios";
bandgridview4.PopulateColumns(set.Tables["relatorios"]);
format_grid_contrato();
format_subgrid_contrato(bandgridview4);
}
I need to use this instance BandedGridView
at an event:
private void click_datagridview4(object sender, EventArgs e)
{
id_etiqueta = Convert.ToInt32(bandgridview4.GetRowCellValue(bandgridview4.GetSelectedRows()[0], "Nº"));
MessageBox.Show("valor id_etiqueta " + id_etiqueta);
}
But when using the above code is generated error:
How could I accomplish this?