codice:Sub VerificaEnte() Dim SQL As String SQL = "SELECT DISTINCT dbo.DettaglioStruttureApplicazioni.IDStruttura, dbo.Strutture.Nome, dbo.TipoStruttura.Nome AS Tipo" & _ " FROM dbo.DettaglioUtentiDSA INNER JOIN dbo.DettaglioStruttureApplicazioni ON dbo.DettaglioUtentiDSA.IDDettaglioStrutturaApplicazione = dbo.DettaglioStruttureApplicazioni.IDDettaglioStrutturaApplicazione INNER JOIN" & _ " dbo.Strutture ON dbo.DettaglioStruttureApplicazioni.IDStruttura = dbo.Strutture.IDStruttura INNER JOIN dbo.TipoStruttura ON dbo.Strutture.IDTipoStruttura = dbo.TipoStruttura.IDTipoStruttura" & _ " WHERE dbo.DettaglioUtentiDSA.IDDettaglioUtentiDSA = " & Request.Cookies("IDDettaglioUtentiDSA").Value Conn.Open() Dim command As New SqlClient.SqlCommand() Dim DRCertificazioni As SqlClient.SqlDataReader command.Connection = Conn command.CommandText = SQL DRCertificazioni = command.ExecuteReader() If DRCertificazioni.Read Then LblTitolo.Text = DRCertificazioni.Item("Tipo") & " " & DRCertificazioni.Item("Nome") IDEnte = DRCertificazioni.Item("IDStruttura") ' riempio la variabile shared con l'id dell'ente di cui fa parte il responsabile End If DRCertificazioni.Close() DRCertificazioni = Nothing Call PreparaConfronto() End Sub Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load CSSStilePagina.Text = "<link type=""text/css"" rel=""stylesheet"" href=""" & LeggiStilePagina(Request.Cookies("IDDettaglioUtentiDSA").Value, Modulo.TipoPagina.Contesto) & """>" ' If Not Page.IsPostBack Then Call VerificaEnte() DACertificazioni.Fill(DsCertificazioni) Page.DataBind() ' End If End Sub Private Sub DGCertificazioni_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGCertificazioni.ItemDataBound Dim Indice For Each Indice In MioArray If e.Item.Cells(0).Text = CStr(Indice) Then Dim Check As New CheckBox() Check.ID = Indice Check.Checked = True e.Item.Cells(1).Controls.Add(Check) Else Dim Check As New CheckBox() Check.ID = Indice Check.Checked = False e.Item.Cells(1).Controls.Add(Check) End If Next 'If e.Item.Cells(1).Text = String.Empty Then ' e.Item.Cells(1).Text = Check ' e.Item.Cells(1).Text = e.Item.Cells(1).Text & e.Item.Cells(0).Text & " '>" 'End If End Sub Sub PreparaConfronto() Dim SQL2 As String SQL2 = "SELECT Certificazioni.IDCertificazione FROM Certificazioni INNER JOIN DettaglioStruttureCertificazioni ON Certificazioni.IDCertificazione =" SQL2 = SQL2 & " DettaglioStruttureCertificazioni.IDCertificazione WHERE DettaglioStruttureCertificazioni.IDStruttura =" & IDEnte Dim Command2 As New SqlClient.SqlCommand() Dim DRRiempiArray As SqlClient.SqlDataReader Command2.Connection = Conn Command2.CommandText = SQL2 DRRiempiArray = Command2.ExecuteReader() While DRRiempiArray.Read MioArray.Add(DRRiempiArray.Item("IDCertificazione")) ' riempo l'array con gli id delle certificazioni che appartengono al mio ente End While DRRiempiArray.Close() DRRiempiArray = Nothing Conn.Close() Conn = Nothing End Sub