Skip to content
Loading
Clicking radio button make control visible/hidden


   

@Model.CourseTitle

   
       
  • @Html.ActionLink("Syllabus", "SyllabusCal", "CourseSection", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Resources", "Index", "CSResMgmt", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Assignments", "Index", "Assignment", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Tests", "Index", "Test", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Projects", "Index", "PrjMgmt", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Roster", "Roster", "CourseSection", new { id = Model.CourseSectionId }, null)
  •        
  • @Html.ActionLink("Groups", "GroupIndex", "CourseSection", new {id = Model.CourseSectionId}, null)
  •        
  • Discussion Board
  •    
    *@
     @*added on 7/22/2013 by vidhya*@
     
     
      @using (Html.BeginForm())
                    {
       
           
               
               
           
       
                   
                         
                             
                               
                             
                               
                          
                                 
                             
                               
                                 
                             
                               
                               
                             
                               
                               
                             
                            
                         
    Create Test
    1.Details
    2.Questions
    3.Preview
    @Html.ActionLink("Button Name", "Index", null, new { @class="classname" })
                    
                    
               
                  
                       

                        @Html.HiddenFor(m => m.CourseSectionId)
        
                       

                           
                                @Html.LabelFor(m => m.TestName)
                                @Html.EditorFor(m => m.TestName)
                               
        
                           
                                @Html.LabelFor(m => m.Description)
                                @Html.EditorFor(m => m.Description)
                           


                           
                                @Html.LabelFor(m => m.Instructions)
                                @Html.EditorFor(m => m.Instructions)
                           
                         

                           @*added on 7/5/2013 by vidhya*@

                         
                           
                       
                                Grading             
                                 
                                   
                                         
    •                                         @Html.EditorFor(m => m.GradeBook)
                                              @Html.LabelFor(m => m.GradeBook)
                                         
                                     
                                 


                                   
                                     
                                           
      •                                      @*  @Html.RadioButton("output", "MakeTestAvailableNow", "true")MakeTestAvailableNow;
                                                @Html.RadioButton("output", "ScheduleDisplayDate", "false")ScheduleDisplayDate;*@
                                                 @Html.RadioButtonFor(model => model.MakeTestAvailable, "MakeTestAvailableNow", true) MakeTestAvailableNow 
                                            @Html.RadioButtonFor(model => model.MakeTestAvailable, "ScheduleDisplayDate", false) ScheduleDisplayDate 
                                           
                           
                                       
                                   

                                     
                                        @Html.LabelFor(m => m.DisplayStart)
                                        @Html.TextBox("DisplayStart", (Model.DisplayStart), new { @class = "date" })
                                   
                                     
                                        @Html.LabelFor(m => m.DisplayClose)
                                        @Html.TextBox("DisplayClose", (Model.DisplayClose), new { @class = "date" })
                                   

                                     
                                       
                                             
        •                                         @Html.EditorFor(m => m.TrackViews)
                                                  @Html.LabelFor(m => m.TrackViews)
                                             
                                         
                                                  
                                     

                               
                             
                             
                                 
                                  Cancel
                             
                

                 

                          }
          0
        • it will work, can you share me the view source of this radio button after rendering?

          Regards,
          Iftikar
          0
        • Iftikar,

          It never work, i am using  like this

            

                @Html.RadioButtonFor(model => model.MakeTestAvailable, "ScheduleDisplayDate", false) ScheduleDisplayDate 

          0
        • this should work,

          $("input[name$='ScheduleDisplayDate']:radio").click(function(){
                      var radioValue = $(this).val();
                      if (radioValue == "1") {
                          $("#DisplayStart").show();
                          $("#DisplayClose").show();
                      }
                      else {
                          alert('aa');
                          $("#DisplayStart").hide();
                          $("#DisplayClose").hide();
                      }
                  });

          Regards,
          Iftikar
          0
        • http://www.c-sharpcorner.com/Forums/Thread/222551/ pls go through this thread and solve my issue there i have given every details regarding this in comments. so pls go through this
          0
        • This also does not work.
          0
        • try like this

          $("#ScheduleDisplayDate").click(function () {
                      var radioButtonID = $("#ScheduleDisplayDate").val();
                      if (radioButtonID == "1") {
                          $("#DisplayStart").show();
                          $("#DisplayClose").show();
                      }
                      else {
                          alert('aa');
                          $("#DisplayStart").hide();
                          $("#DisplayClose").hide();
                      }
                  });

          Regards,
          Iftikar
          0
        • Iftikar,

          No reflect here. it seems to same while check or uncheck.


          0
        • Hi,
                  You can do by using jquery

          $(document).ready(function () {
            $("#ScheduleDisplayDate").click(function (e) {
            if ($("#ScheduleDisplayDate").is(":checked")) {
                  $("#DisplayStart").css("visibility","visible");
                  $("#DisplayClose").css("visibility","visible");
              }
              else{
                  $("#DisplayStart").css("visibility","hidden");
                  $("#DisplayClose").css("visibility","visible");
              }
           });


          Regards,
          Iftikar
          0