mvc razor show hide any id based on dropdown



Drop Down
 @Html.DropDownListFor(m => m.AttendenceBonus.BonusIn, new SelectList(Model.BonusInList, "Value", "Text", Model.AttendenceBonus.BonusIn), new { @class = "selectBoxRegular", onchange = "return GetBonusType(this);"})  

Script
 <script>  
   function GetBonusType(ctrl) {  
     var x = $("#AttendenceBonus_BonusIn").val();  
     // hide any control by id  
       if (x == "Fixed") {  
         $('#persent').text("");  
         $('#Applylevel').show();  
         $('#AttendenceBonus_BonusApplyOn').show();  
       }  
      // Show any control by id  
       else {  
         $('#persent').text("%");  
         $('#Applylevel').hide();  
         $('#AttendenceBonus_BonusApplyOn').hide();  
       }  
    }  
 </script>  

Popular posts from this blog

WPF Crystal Report Viewer Using SAP

mvc razor textboxfor change event change another textboxfor value

ASP.NET MVC razor SAP Crystal report