473,769 Members | 4,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:TemplateFi eld>
<EditItemTempla te>
<asp:RadioButto nList ID="r1" SelectedValue=' <%# Bind("myfield") %>'
runat="server">
</asp:RadioButton List>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label31" runat="server" Text='<%# Bind("myfield")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
------------------------------
Protected Sub GridView1_RowCr eated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles GridView1.RowCr eated
If e.Row.RowState And DataControlRowS tate.Normal =
DataControlRowS tate.Normal Then
If e.Row.RowType = DataControlRowT ype.DataRow Then
Dim lb As Label
lb = CType(e.Row.Fin dControl("label 31"), Label)
If lb.Text = "True" Then
lb.Text = "Yes"
Else
lb.Text = "No"
End If
End If
End If

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

Protected Sub GridView1_RowDa taBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
GridView1.RowDa taBound
If (e.Row.RowState And DataControlRowS tate.Normal) =
DataControlRowS tate.Normal Then
If e.Row.RowType = DataControlRowT ype.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.vbschr eef in bericht
news:eW******** ******@TK2MSFTN GP06.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:TemplateFi eld>
<EditItemTempla te>
<asp:RadioButto nList ID="r1" SelectedValue=' <%# Bind("myfield") %>'
runat="server">
</asp:RadioButton List>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label31" runat="server" Text='<%# Bind("myfield")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
------------------------------
Protected Sub GridView1_RowCr eated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
GridView1.RowCr eated
If e.Row.RowState And DataControlRowS tate.Normal =
DataControlRowS tate.Normal Then
If e.Row.RowType = DataControlRowT ype.DataRow Then
Dim lb As Label
lb = CType(e.Row.Fin dControl("label 31"), 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
7336
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
2219
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 works ok, it selects the correct radio button based on the field text. But I cannot get it to update when I change the selected radiobutton.
6
2643
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 in the page and I've got code to get the selected value from it in the Radiobuttonlist_SelectedIndexChanged event. The code in there is: Protected Sub rblFMSValue_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
1
10763
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 RadioButtonList (for options). The 2nd Template field is the primary key value. And i have a button on the form. In the button click event i wrote code to grab RadioButtonList values.But the selected value is coming as null....PLEASE ADVISE.... Let me...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10036
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.