Datagrid Item Question
Hi, everyone. I got a question for changing the contents of datagrid items before display the datagrid.
What I want to do is change the boolean value(True/False) in the database table to Yes/No string before the page display the table, and the table is in datagrid. I think e.Item.Cells(2).Text should return all the boolean values from the datagrid. However, it only returns empty string. Here is my code:
Sub dgLibrary_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgLibrary.ItemDataBound
If e.Item.ItemType = ListItemType.Item
Or e.Item.ItemType=ListItemType.AlternatingItem Then
If e.Item.Cells(2).Text = "True" Then
e.Item.Cells(2).Text = "Yes"
End if
End If
End If
End Sub
Thanks a lot!
Kai
|