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

How can I activate or deactivate users in kendo grid using check boxes?

1 Answer 85 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 2
Steven asked on 05 Aug 2014, 07:59 PM
@using (Html.BeginForm("Update", "MyUsers", FormMethod.Post))
{

@(Html.Kendo().Grid(Model).Name("Usersgrid").Columns(col =>
{
col.Bound(i => i.Id).Hidden();
col.Bound(b => b.Email);

col.Bound(p => p.UserActive).ClientTemplate("<input type='checkbox'
name='checkedvalues' class='chkbx'
value='#= Id #' " + "# if (UserActive)
{ #" + "checked='checked'" + "# } #" + "/>" +

" <input type=\"hidden\" name=\"checkedvals\"
value=\"#=Id#\"/>")
.HeaderTemplate("<input type='checkbox' id='checkAll' /><label
for='checkAll'>Select </label>").Width(120);

col.Command(c => c.Custom("Remove").Click("remove")).Width(120);

}).DataSource(d => d.Ajax()
.Model(m => m.Id("Id"))
.Read(p => p.Url("/Customers/GetCustomerIndex").Type(HttpVerbs.Get)))

)
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save Users" class="btn btn-default" id="btnGroupInv2" style="color: rgb(8, 4, 36)" />
</div>
</div>
}
 I have "SelectAll" header template for checking and unchecking for all check boxes.I am unable to post the unchecked values with id's on clicking submit button ?I spent many hours on this. Any Suggestions  or any other methods would be grateful thanks

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 07 Aug 2014, 01:32 PM
Hello Steven,

Only checked items are submit to the server. 

http://stackoverflow.com/questions/11424037/does-input-type-checkbox-only-post-data-if-its-checked

Consider using a hidden input. Similar approach is used in this code library:

http://www.telerik.com/support/code-library/submit-form-containing-grid-along-with-other-input-elements

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MVVM
Asked by
Steven
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or