2010-06-06 5 views
0
<asp:RadioButtonList ID="RdoBtnHasNotified" runat="server" 
    RepeatDirection="Horizontal" AutoPostBack="True" 
    OnSelectedIndexChanged="RdoBtnHasNotified_SelectedIndexChanged"> 
<asp:ListItem Value="1">Yes</asp:ListItem> 
<asp:ListItem Value="0" Selected="True">No</asp:ListItem> 
</asp:RadioButtonList></td> 

<asp:TextBox ID="TxtHowNotified" runat="server" TextMode="MultiLine" MaxLength="100"></asp:TextBox></td> 

Répondre

0

Cela devrait faire l'affaire:

$('#<%= RdoBtnHasNotified.ClientID =%>').click() { 
    if ($(this).find('input:checked').val()) == 'Yes' { 
     $('#idOfYourTextBox').attr('enabled','true'); 
    } 
} 
-1
<asp:RadioButtonList ID="rbl" runat="server" onclick="Toggle()"> 
    <asp:ListItem Value="0">No</asp:ListItem> 
    <asp:ListItem Value="1">Yes</asp:ListItem> 
</asp:RadioButtonList> 


<asp:TextBox ID="TextBox1" runat="server" style="display:none" /> 

JS

<script type="text/javascript"> 


function Toggle() 
{ 
    var radio = document.getElementsByName('<%=rbl.ClientID %>'); 
    var txt = document.getElementById('<%=TextBox1.ClientID %>'); 
     for (var j = 0; j < radio.length; j++) 
     { 
      if (radio[j].checked) 
      { 
       if(radio[j].value == '1') 
       { 
        txt.style.display = ''; 
       } 
       else 
       { 
        txt.style.display = 'none'; 
       } 
      } 
     } 
} 
</script> 
+0

pourquoi vous avez pris pour la boucle au lieu que vous pouvez simplement le faire par si les conditions seulement ?? –

Questions connexes