B
Ben
Hi,
The gridview contains a radiobuttonlist with boolean values (true/false)
coming from a database. In normal mode, 'True' or 'False' is dispalyed. In
edit mode, the radiobuttonlist appears.
What i want is to change True' and 'False' by 'Yes' and 'No' in normal mode.
I tried this code below and i get Yes/No in normal mode, but also in edit
mode instead of the radiobuttonlist which has gone ...
Thanks for help
Ben
<asp:TemplateField>
<EditItemTemplate>
<asp:RadioButtonList ID="r1" SelectedValue='<%# Bind("myfield") %>'
runat="server">
</asp:RadioButtonList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label31" runat="server" Text='<%# Bind("myfield")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound
If (e.Row.RowState And DataControlRowState.Normal) =
DataControlRowState.Normal Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim st As String
st = e.Row.Cells(5).Text
If st = "True" Then
e.Row.Cells(5).Text = "Yes"
Else
e.Row.Cells(5).Text = "No"
End If
End If
End If
End Sub
The gridview contains a radiobuttonlist with boolean values (true/false)
coming from a database. In normal mode, 'True' or 'False' is dispalyed. In
edit mode, the radiobuttonlist appears.
What i want is to change True' and 'False' by 'Yes' and 'No' in normal mode.
I tried this code below and i get Yes/No in normal mode, but also in edit
mode instead of the radiobuttonlist which has gone ...
Thanks for help
Ben
<asp:TemplateField>
<EditItemTemplate>
<asp:RadioButtonList ID="r1" SelectedValue='<%# Bind("myfield") %>'
runat="server">
</asp:RadioButtonList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label31" runat="server" Text='<%# Bind("myfield")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound
If (e.Row.RowState And DataControlRowState.Normal) =
DataControlRowState.Normal Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim st As String
st = e.Row.Cells(5).Text
If st = "True" Then
e.Row.Cells(5).Text = "Yes"
Else
e.Row.Cells(5).Text = "No"
End If
End If
End If
End Sub