Solved

Set selectedvalue on radiobuttonlist

Posted on 2009-05-20
3
419 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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