Monday, 26 December 2011

Dispalying selected value of RBL Control

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 i=0;i<Gen.cells.length;i++)
{
if(Gen.cells.firstChild.checked)
{
alert("You've selected Gender is:"+Gen.cells.firstChild.value);
}
}
}
.cs
page Load call Javascript
{
btnsubmit.attribure.add("onClick","ShowSelectedGender()");
}

No comments:

Post a Comment