CheckBoxGroup razor-page biding and get selected values back on post

1 Answer 194 Views
CheckBoxGroup
Mikko
Top achievements
Rank 1
Mikko asked on 18 Oct 2022, 06:57 AM

Hello,

I have followed this help article, how to bind CheckBoxGroup to model on razor page. This article does not show how to get selected values back on post. 

https://docs.telerik.com/aspnet-core/html-helpers/editors/checkboxgroup/razor-page

OnPost CheckBoxGroupModel models that is bind property, it's CheckBoxGroupValue property stays null when posted back. Only way to get values back is to read them from Request.Forms["checkboxgroup"].

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 20 Oct 2022, 04:01 PM

Hello Mikko,

There are two ways to send the CheckBoxGroup's Value back to the server.

  1. Put the CheckBoxGroup's Component into a form and handle the form's submission in the back end.
  2. Access the Value by utilizing the client-side value method of the Component
    $(document).ready(function(){
        var checkGroup = $("#checkboxgroup").getKendoCheckBoxGroup();
        var checkGroupValues = checkGroup.value();
    });

I hope the information above is useful. Please don't hesitate to contact me, if more questions on the topic arise.

Regards,
Stoyan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
CheckBoxGroup
Asked by
Mikko
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or