Telerik grid with checkbox - the checkbox is not displayed when the grid is originally paint

I have a telerik grid with a checkbox. I am using a client template. There is an attached .DataBinding Ajax call.

When a grid first appears, not a check box, it has an id value of text. If I click update, the ajax call will be made, and when it returns, a checkbox will appear. Is there a way to make an ajax call happen when the grid initially draws so that I have a checkbox and not text ...

Code example:

<% Html.Telerik().Grid(Model.AdminSongQueue) .Name("Grid") .Columns(columns => { columns.Bound(o => o.UserTrackAssignmentID) .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= UserTrackAssignmentID #>' />") .Title("Check") .Width(50) .HtmlAttributes(new {style="text-align:center"}); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_CheckBoxesSongGrid", "RightsToolSvc")) .Scrollable() .Pageable() .Render(); %> 
+1
source share
2 answers

Yes, it’s possible: you just need to call the empty constructor of the Grid class like this, and bind the grid by calling the ajax select method to bootstrap the data too:

 Html.Telerik().Grid<YourModelDataType>().Name("Grid")... 
+1
source

In my view (viewname.cshtml, MVC), I added the following before my .ClientTemplate:

  .Template( @<text> <input type='checkbox' id='chkMessage' name='checkedMovies' value='<#= ID #>' /> </text>) 

...

This post is related, I found my answer here

+1
source

All Articles