85 messaggi dal 04 marzo 2012
Ciao,
ho una gridview che contiene una serie di campi hyperlinkfield (uno per ogni giorno del mese).
alcune celle contigue possono contenere il link alla stessa pagina oppure essere vuote o contenere un link diverso, pertanto vorrei formattare la gridview unendo le celle con link uguale usando columnspan e cambiando il colore backcolor, così da avere un unico link.
Come faccio a controllare se due celle contengono lo stesso hyperlink? con il codice seguente riesco a farlo con dei campi contenente del testo

For i As Integer = dgvCalendarioMese.Rows.Count - 1 To 1 Step -1
Dim row As GridViewRow = dgv.Rows(i)
Dim CS As Integer
Dim saveCellaInizio As Integer

CS = 1
saveCellaInizio = 0
For j As Integer = 2 To row.Cells.Count - 1
If j < 33 Then ' se non è l'ultimo record
If row.Cells(j).Text <> "" Then
If saveCellaInizio = 0 Then 'Salvo la prima cella
saveCellaInizio = j
End If
If row.Cells(j).Text = row.Cells(j + 1).Text Then
CS = CS + 1
row.Cells(saveCellaInizio).ColumnSpan = CS
row.Cells(j).BackColor = Drawing.Color.Aquamarine
row.Cells(j + 1).Visible = False
Else
CS = 1
saveCellaInizio = 0
End If
End If
Else
If row.Cells(j).Text <> "" Then
row.Cells(j).BackColor = Drawing.Color.Aquamarine
End If

End If
Next
Next
85 messaggi dal 04 marzo 2012
Ho riolto, basta usare DirectCast(row.Cells(j).Controls(0), HyperLink).Text

con questo riesco leggere il valore del DataTextField

Grazie comunque.

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.