locked
how to display content using radiobuttonlist and jquery mvc RRS feed

  • Question

  • User569149469 posted

    Hi,

    I have a radiobutton like this

    @Html.RadioButton("rbGrp", "1", isChecked = false
        )@Html.Label("YES")
    @Html.RadioButton("rbGrp", "1", isChecked = false)@Html.Label("NO")based on the selection I need to display values from checkboxlist from server how to do it
    Tuesday, November 20, 2018 6:57 PM

All replies

  • User1520731567 posted

    Hi phmaspnet,

    I am not very clear about your scene.

    Do you mean you want to :

    select Yes then display checkboxlist :ABC...

    select No then display checkboxlist :DEF...?

    And what is your database design?

    You could use model binding and ajax to change your value.

    OR

    select Yes then display checkboxlist :ABC...

    select No and then checkboxlist does not display data?

    If so,I suggest you could use javascript to check

    For example:

    ...
    @Html.RadioButton("rbGrp", "Yes", new { id = "rbGrpYes" })
    @Html.Label("YES")
    @Html.RadioButton("rbGrp", "No", new { id = "rbGrpNo" })
    @Html.Label("NO")
    ...
    
    <script>
        ...
        if ($("input[name='rbGrp']:checked").val() == "Yes")//if select Yes
        {
            //do something...
        }
        else //if select No or Null
        {
            //do something...
        }
        ...
    </script>
    
    
    

    Best Regards.

    Yuki Tao

    Wednesday, November 21, 2018 4:46 AM