Hi Alison,
Actually, the simple way is to convert the retired value in your SQL query.
Instead of using
SELECT retired, . FROM table_name
You can use
Select (CASE WHEN retired = 1 THEN 'Retired' ELSE 'Active' END) AS
retired, ... FROM table_name
HTH
[quoted text, click to view] "Alison" <aspnet.meister@gmail.com> wrote in message
news:1122789702.609167.233940@g44g2000cwa.googlegroups.com...
> 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
>