Label In Between RadioButtonList

R

rn5a

A ASPX page has a RadioButtonList with 2 ListItems - 'Yes' & 'No'

<form runat="server">
<asp:RadioButtonList ID="rdlAdd" OnSelectedIndexChanged="ShowHide"
AutoPostBack="true" runat="server">
<asp:ListItem Value="yes">Yes</asp:ListItem>
<asp:ListItem Value="no">No</asp:ListItem>
</asp:RadioButtonList>
</form>

When the page loads for the first time, neither of the 2 RadioButtons
are checked by default.

What I want is when a user checks the 'Yes' RadioButton, a Label should
get displayed IN BETWEEN the 2 RadioButtons. In other words, the Label
should be displayed immediately after the 'Yes' RadioButton. If the
'No' RadioButton is checked, then the already rendered Label in between
the 2 RadioButtons should become invisible & another Label should be
displayed after the 'No' RadioButton.

The problem is how do I display a Label control IN BETWEEN the 'Yes' &
'No' RadioButtons when the 'Yes' RadioButton is checked?
 
D

dotnet dude

I dont have the visual studio open but this seems to be an easy task
.... all you need to do is in the server event iterate thru the
RadioButtonList.Items collection and change the ListItem.Text property
to "" for the radio button for which you dont want any txt displayed.
....
hope that helps ..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top