Set Radiobuttonlist Value via Javascript

A

Alphonse Giambrone

Hi all,

I have two radiobuttonlist controls on a page. When a user checks 'No' for
rblDeleted, I want to automatically set rblSendCard to 'No' and disable it.
The javascript function I wrote to do this 'appears' to work on the screen,
however, when the page is posted back and I check the value of rblSendCard,
it is an empty string when I expect it to be 'N'.
Of, course I can work around the problem by assuming 'N' when it is an empty
string, but would prefer to have the correct value posted back.

Can anyone tell me how to get it to work the way I expect or explain why it
can't.
Code is below.
TIA

<asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
RepeatDirection="Horizontal" CellPadding="0"
CellSpacing="0" EnableViewState="False">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:radiobuttonlist>
<asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
RepeatDirection="Horizontal" EnableViewState="False"
CellPadding="0" CellSpacing="0">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N" Selected="True">No</asp:ListItem>
</asp:radiobuttonlist>

<script language="JavaScript"> function SetDeleted() {
if(document.getElementById('U_Members1_rblDeleted_0').checked){
document.getElementById('U_Members1_rblSendCard_1').checked=true;
document.getElementById('U_Members1_rblSendCard').disabled='disabled';}
else{
document.getElementById('U_Members1_rblSendCard').disabled='';}}</script>
 
W

William F. Robertson, Jr.

When an html element is disabled, it is not posted in the Request.Forms
Collection.

bill
 

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

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top