Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All.
I want to display Panel when i clicked on radio button list item. I wrote code like this .and i called this function in radibuttonlist onclick.I hide panel in another function.
JavaScript
function displaypanel()
{

   var pnltlmapobj=document.getElementById('<%=rbtntlmapyn.ClientID%>');
   var pnltlmap= pnltlmapobj.getElementsByTagName('input');

   if(pnltlmap.item(0).checked==true)
   {
      document.getElementByID('pnltlmapping').style.display = 'block';

   }

}

Thanks & Regards
Hari
Posted
Updated 12-Oct-12 1:11am
v2
Comments
AshishChaudha 12-Oct-12 8:22am    
and?? what the problem??

you can do both action in single function.
use below code :

JavaScript
function DisplayHidePanel(RadioButtonListId, PanelId) {
           var radio = document.getElementsByName(RadioButtonListId);
           if (radio.length > 0) {
               for (var j = 0; j < radio[0].cells.length; j++) {
                   for (var k = 0; k < radio[0].cells[j].children.length; k++) {
                       if (radio[0].cells[j].children[k].checked == true &&               radio[0].cells[j].innerText == "Yes") {
                           document.getElementById(PanelId).style.display =  "block";
                       }
                       else if (radio[0].cells[j].children[k].checked == true  && radio[0].cells[j].innerText == "No") {
                           document.getElementById(PanelId).style.display = "none";
                       }
                   }
               }
           }
       }
 
Share this answer
 
v3
Comments
Hari Krishna Prasad Inakoti 12-Oct-12 9:41am    
Thanq for ur response.I got it in my function only.
fjdiewornncalwe 12-Oct-12 10:32am    
+5. Correct.
RaisKazi 12-Oct-12 14:03pm    
5ed!
This is My Answer.I got it.

C#
function displaypanel()
{
   var pnltlmapobj=document.getElementById('<%=rbtntlmapyn.ClientId%>');
   var pnltlmap= pnltlmapobj.getElementsByTagName('input');
   if(pnltlmap.item(0).checked==true) {
      //pnltlmap.item(0).checked=true;
      document.getElementById('<%=pnltlmapping.ClientId%>')
         .style.display="block";
   }
   else {
      //pnltlmap.item(1).checked=true;
      document.getElementById('<%=pnltlmapping.ClientId%>')
         .style.display="none";
   }
   return false;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900