Bonjour,
Essai de jouer avec le nombre de caractères à afficher.
Tu vas dans le rowdatabound et tu pourras formater ton affichage.
du style:
Protected Sub maDataGridView_RowDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
' Gestion de l'affichage de l'année comptable
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
' Gestion de l'affichage du mois comptable.
Select Case Integer.Parse(e.Row.Cells(2).Text)
Case 1
e.Row.Cells(2).Text = "Jan."
Case 2
e.Row.Cells(2).Text = "Fev."
Case 3
e.Row.Cells(2).Text = "Mar."
Case 4
e.Row.Cells(2).Text = "Avr."
Case 5
e.Row.Cells(2).Text = "Mai"
Case 6
e.Row.Cells(2).Text = "Juin"
Case 7
e.Row.Cells(2).Text = "Jui."
Case 8
e.Row.Cells(2).Text = "Aoû."
Case 9
e.Row.Cells(2).Text = "Sep."
Case 10
e.Row.Cells(2).Text = "Oct."
Case 11
e.Row.Cells(2).Text = "Nov."
Case 12
e.Row.Cells(2).Text = "Déc."
End Select
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
' Gestion de l'affichage de l'intitulé de l'écriture.
Dim lngTextIntituleEcritureComptable As Integer = 6
Dim strIntituleEcriture As String = e.Row.Cells(4).Text
If e.Row.Cells(4).Text.Length > lngTextIntituleEcritureComptable Then
e.Row.Cells(4).Text = e.Row.Cells(4).Text.Substring(0, lngTextIntituleEcritureComptable) & "..."
End If
e.Row.Cells(4).Attributes.Add("Title", strIntituleEcriture) 'e.Row.DataItem("Intitulé Ecrit. Compt.").ToString())
' Gestion de l'affichage du N° du journal
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
' Gestion de l'affichage de N° de classement
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
' Gestion de l'affichage du sens de l'écriture.
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Center
' Gestion de l'affichage pour le montant de l'écriture.
e.Row.Cells(9).Text = String.Format("{0:c2}", CType(e.Row.Cells(9).Text, Double))
e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right
' Gestion de l'affichage du lettrage
e.Row.Cells(10).HorizontalAlign = HorizontalAlign.Center
' Gestion de l'affichage de l'intutilé du budget.
Dim lngTextIntituleBudget As Integer = 8
Dim strIntituleBudget As String = e.Row.Cells(11).Text
If e.Row.Cells(11).Text.Length > lngTextIntituleBudget Then
e.Row.Cells(11).Text = e.Row.Cells(11).Text.Substring(0, lngTextIntituleBudget) & "..."
e.Row.Cells(11).Attributes.Add("Title", strIntituleBudget)
End If
e.Row.Cells(11).HorizontalAlign = HorizontalAlign.Justify
' Gestion du type de budget.
e.Row.Cells(12).HorizontalAlign = HorizontalAlign.Center
' Gestion de la description de la facture
Dim lngTextDescription As Integer = 10
Dim strDescription As String = e.Row.Cells(13).Text
If e.Row.Cells(13).Text.Length > lngTextDescription Then
e.Row.Cells(13).Text = e.Row.Cells(13).Text.Substring(0, lngTextDescription) & "..."
e.Row.Cells(13).Attributes.Add("Title", strDescription)
End If
e.Row.Cells(13).HorizontalAlign = HorizontalAlign.Justify
End If
End Sub
Avec cet exemple, tu pourras faire à mon avis pas mal de chose.
a+
PascalCmoa
email: PascalCmoa