This question is locked. New answers and comments are not allowed.
Hello dear Telerik,
What is the best way to pass values of checked Grid rows to controller, but without the form postback?
The thing is that I'm using combination of Grid and Menu. The Grid contains data and allows to select specific rows with checkboxes and The Menu provides various actions on selected rows. The actions will be in different controllers.
When I try to pass checkedRecords from Action method of Menu item as is, I receive null. The code I use is taken from Telerik Demo site.
Thank you much!
What is the best way to pass values of checked Grid rows to controller, but without the form postback?
The thing is that I'm using combination of Grid and Menu. The Grid contains data and allows to select specific rows with checkboxes and The Menu provides various actions on selected rows. The actions will be in different controllers.
When I try to pass checkedRecords from Action method of Menu item as is, I receive null. The code I use is taken from Telerik Demo site.
@{int[] checkedUsers = (int[])ViewData["checkedUsers"];} @{ Html.Telerik().Menu() .Items(menu => {
... item.Add().Text(Model.InitialPackage.PackageName) .Action("AssignPackageToUsers", "AdminAuditionPackages", new { packageId = Model.InitialPackage.PackageId, checkedUsers = checkedUsers }) }; }) .Render();} @(Html.Telerik().Grid(Model.Users) .Name("FoundUsersGrid") .DataKeys(keys => keys.Add(u => u.UserId)) .Columns(columns => { columns.Template( @<text> <input name="checkedUsers" type="checkbox" value="@item.UserId " title="checkedRecords" @{if (checkedUsers != null){ if (checkedUsers.Contains(item.UserId)) { <text>checked="checked"</text> } }} /> </text>) .Title("").Width(36).HtmlAttributes(new { style = "text-align:center" }); ... columns.Bound(u => u.Specialities).Width(200); }) )Thank you much!