private void loadSubGrids() { if (grdEventi.SelectedRows.Count == 1) { if (grdEventi.Columns.Contains("Numero") && grdEventi.SelectedRows[0].Cells["Numero"].Value != null) { long codEvento = long.Parse(grdEventi.SelectedRows[0].Cells["Numero"].Value.ToString()); using (databaseContext = CreateDatabaseContext()) { manager = new EventiManagerNew(databaseContext); grdCartellini.DataSource = manager.GetItemsToPrint(codEvento); grdDischi.DataSource = manager.GetDisksToPrint(codEvento); } } } else { grdCartellini.DataSource = null; grdDischi.DataSource = null; } }