Solved

Set selectedvalue on radiobuttonlist

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Title # Comments Views Activity
exporting html table data 4 38
ASP.NET (VB) return a record 2 52
asp.net figure out error 3 24
orderby list (from Json) 1 29
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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