Dispalying selected value of RBL Control

Self-innovator
Posted by Self-innovator under JavaScript category on | Points: 40 | Views : 1319
Design:
<asp:radiobuttonlist id="rblGender" runat="server">
<asp:listitem text="Male"/>
<asp:listitem text="FeMale"/>
<asp:Radiobuttonlist>

Javascript:
function ShowSelectedGender()
{
var Gen=document.getelementbyid("rblGender");
for(var k=0;i<Gen.cells.length;k++)
{
if(Gen.cells[k].firstChild.checked)
{
alert("You've selected Gender is:"+Gen.cells[k].firstChild.value);
}
}
}

.cs
page Load call Javascript
{
btnsubmit.attribure.add("onClick","ShowSelectedGender()");
}

Comments or Responses

Posted by: T.saravanan on: 12/26/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Kindly post your code inside the code tag.

Note:
1. Provide the proper Title for your code snippet then only user easily to identitfy your code.
2. In our DNF website Square brace of 'i' like ["i"] is consider as "Italic" format. So use other chars instead of 'i'

Login to post response