473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

can't change radiobuttonlist displayed value in normal mode of gridview

Ben
Hi,

The gridview contains a radiobuttonlist with boolean values (true/false)
coming from a database.

In normal mode, the gridview displays True or False for that field.
What i want is to change True' and 'False' by 'Yes' and 'No' in normal mode.
I tried this, but still get True / False.

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_RowCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
If e.Row.RowState And DataControlRowState.Normal =
DataControlRowState.Normal Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lb As Label
lb = CType(e.Row.FindControl("label31"), Label)
If lb.Text = "True" Then
lb.Text = "Yes"
Else
lb.Text = "No"
End If
End If
End If

Jun 27 '08 #1
1 1959
Ben
I tried this:

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

Now, i have Yes/No in normal mode, but also in edit mode instead of the
radiobuttonlist which has gone ...


"Ben" <be*@nol.vbschreef in bericht
news:eW**************@TK2MSFTNGP06.phx.gbl...
Hi,

The gridview contains a radiobuttonlist with boolean values (true/false)
coming from a database.

In normal mode, the gridview displays True or False for that field.
What i want is to change True' and 'False' by 'Yes' and 'No' in normal
mode.
I tried this, but still get True / False.

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_RowCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowCreated
If e.Row.RowState And DataControlRowState.Normal =
DataControlRowState.Normal Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lb As Label
lb = CType(e.Row.FindControl("label31"), Label)
If lb.Text = "True" Then
lb.Text = "Yes"
Else
lb.Text = "No"
End If
End If
End If

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: pvong | last post by:
VB.NET How do you change a gridview from Update mode to normal mode? I'm usually dealing for Formviews and there is a ChangeMode option but I don't see one for Gridviews.
3
by: =?Utf-8?B?SmFtZXM=?= | last post by:
Hello, I'm trying to build a simple booking page. I have a Gridview and one of the columns is a Radiobuttonlist with the options Attending / Not Attending. This is bound to the field . This...
6
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered...
1
by: renuami | last post by:
Hello friends please advise....... I am building an application for Survey. For this i have GridView with two Template fields. The first Template has Label (To display question text) and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.