A
Alison
I need to change the contents of the datafield to make it look a bit
more userfriendly.
What I have at the moment is as follows:
<asp:BoundColumn DataField="retired" HeaderText="Retire
Status"></asp:BoundColumn>
Where the "retired" is extacted from a database table and has a bit
datatype; so either 0 or 1. When the grid is displayed, I have written
some code to change the default 'false' or 'true' values to show
'active' or 'retired'. That works fine.
The code I use is:
Sub Item_Bound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
' Retrieve the text of the RetiredColumn from the
DataGridItem
' and convert the value .
If e.Item.Cells(3).Text = "False" Then
' Format the value as Active and redisplay it in the
DataGrid.
e.Item.Cells(3).Text = "Active"
Else ' retirement status is 'retired'
e.Item.Cells(3).Text = "Retired"
End If
End If
End Sub
However, when I click on the Edit button to update the contents of that
row in the datagrid, it again displays 'true' or 'false' in the
editable textbox. This is not what I want. I want it to show either
'retired' or 'active'. How can I do this? A drop-down box would be best
for this, but I'm trying to keep things simple at this point until I"m
a bit more experienced with asp.net.
TIA
more userfriendly.
What I have at the moment is as follows:
<asp:BoundColumn DataField="retired" HeaderText="Retire
Status"></asp:BoundColumn>
Where the "retired" is extacted from a database table and has a bit
datatype; so either 0 or 1. When the grid is displayed, I have written
some code to change the default 'false' or 'true' values to show
'active' or 'retired'. That works fine.
The code I use is:
Sub Item_Bound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
' Retrieve the text of the RetiredColumn from the
DataGridItem
' and convert the value .
If e.Item.Cells(3).Text = "False" Then
' Format the value as Active and redisplay it in the
DataGrid.
e.Item.Cells(3).Text = "Active"
Else ' retirement status is 'retired'
e.Item.Cells(3).Text = "Retired"
End If
End If
End Sub
However, when I click on the Edit button to update the contents of that
row in the datagrid, it again displays 'true' or 'false' in the
editable textbox. This is not what I want. I want it to show either
'retired' or 'active'. How can I do this? A drop-down box would be best
for this, but I'm trying to keep things simple at this point until I"m
a bit more experienced with asp.net.
TIA