This is a migrated thread and some comments may be shown as answers.

Save checkbox results

1 Answer 169 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Beryl
Top achievements
Rank 1
Beryl asked on 18 Jan 2013, 02:14 PM
I have a staff page with a button "Add to groups"

When add to groups is clicked, a kendo window is opened. I can get all my checkboxes to display fine in this window, I just need to save the results back into the model or something similar, to get access to them in my controller so that I can save to database.

Any way to do this using kendo methods?

Code for the popup window below 

@(Html.Kendo().PanelBar()
        .Name("panelbar")
        .ExpandMode(PanelBarExpandMode.Single)
        .HtmlAttributes(new { style = "width:300px" })
        .Items(panelbar =>
        {
            panelbar.Add().Text("Search")
                .Expanded(true)
                .Content(@<div style="padding: 10px;">
                    <div>
                        <input class="k-autocomplete" type="text" name="search">
                    </div>
                    </div>);
            
            
            panelbar.Add().Text("Name")
                .Expanded(true)
                .Content(@<div style="padding: 10px;">
                    @foreach (var Name in Model.groups) {
                        <div class="filterBox">
                            <input type="checkbox"  name="@Name.Name" > @Name.Name
                        </div>
                    }
                    </div>);
       
       
            

                
                
                
                
                
               
        })
       )

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Jan 2013, 11:24 AM
Hi Beryl,

The easiest way to send the data back to the controller is to put a form inside the Content of your PanelBar. For example:

.Content(@<div style="padding: 10px;">
   <form action="@Url.Action("Submit")" method="post">
   @foreach (var Name in Model.groups) {
       <div class="filterBox">
           <input type="checkbox"  name="@Name.Name" > @Name.Name
       </div>
   }
   <input type="submit"  value="Submit" />
   </form>
   </div>);

Another option for you is to add a custom button, which performs an Ajax request when clicked.
I hope this information will solve your issue.

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Beryl
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or