Solved

Set selectedvalue on radiobuttonlist

Posted on 2009-05-20
3
421 Views
Last Modified: 2012-08-14
I have a radiobuttonlist in a form with three values and at some times I want to be able to update the form and then I want the selected radiobutton from before to be selected.

I've tried this and it works except that the actual radiobutton is'nt checked at update state.


<asp:RadioButtonList ID="rbAllowOptions" RepeatDirection="Horizontal" runat="server">
                <asp:ListItem Value="Credit Card" Text="Credit card" />
                <asp:ListItem Value="Invoice" Text="Invoice" />
                <asp:ListItem Value="Both" Text="Both" />
            </asp:RadioButtonList>
 
---------------------------------------------------------
Dim ccArray As New ArrayList
                                    ccArray = GetCreditCardDef(iIdentity) 'checks if Credit Card is selected
 
                                    If (ccArray(7) = "True") Then"
                                        rbAllowOptions.Items.FindByValue("Credit Card").Selected = True
                                    End If

Open in new window

0
Comment
Question by:mattegol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:rdoran0928
ID: 24431556
you won't see the radio button checked until your page does a postback
0
 
LVL 4

Accepted Solution

by:
rdoran0928 earned 250 total points
ID: 24433075
There's a simpler way to set:

rbAllowOptions.SelectedValue = "Credit Card"

Also, you may have a problem in that value in text are different in case

<asp:ListItem Value="Credit Card" Text="Credit card" />

Value is upper case Card, text is lower case card
0
 

Author Comment

by:mattegol
ID: 24435016
Thanks for your comments I'm gonna test it tomorrow.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question