Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Change Text in DataGrid Cell
Message
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Divers
Thread ID:
00672652
Message ID:
00672678
Vues:
8
Alan

I had to modify it at the during the ItemDataBound()

Here is the code:
  Sub dgData_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)

   ' Get a count of the Cells in the current Item (Row)
    Dim i As Integer = e.Item.Cells.Count
    Dim j As Integer = 0 ' Counter variable
    Dim oCell As TableCell

   ' Enumerate the Cells in the current Item
    For Each oCell In e.Item.Cells
       If e.Item.Cells(j).Text = "0" Then
          e.Item.Cells(j).Text = " "
       End If
       j += 1
    Next

End Sub
and went into the HTML and put:
<!-- Added OnItemDataBound attribute to control
<asp:DataGrid
    Id="dgData" 
    Runat="Server"
    OnItemDataBound="dgData_ItemDataBound"
    BorderColor="Black"
    BorderWidth="1" 
    Gridlines="Both"
    AlternatingItemStyle-BackColor="Moccasin"
    HeaderStyle-BackColor="#336600"
    HeaderStyle-ForeColor="#ffffff" 
    HeaderStyle-Font-Bold="True"
    Width="75%"  
/>
Now the cells that had a zero show up blank.

Thanks
Kirk
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform