Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben - 29 May 2008 15:30 GMT
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
Ben - 29 May 2008 20:22 GMT
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 ...

> Hi,
>
[quoted text clipped - 36 lines]
> End If
> End If

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.