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

[Solved] Grid Checkboxes

2 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Denise
Top achievements
Rank 1
Denise asked on 18 Aug 2011, 06:58 PM

I have an .ascx view that I need to use the server and client checkbox templates.  If I use the ClientTemplate by itself the example works.  If I add or just try to use the server .Template or .HeaderTemplate, I get a syntax (unexpected token) issue.  I used the exact syntax from the Telerik site example.  If someone could get this working it would be much appreciated.  Thx.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MultiSelectList>" %>

<%= Html.Telerik().Grid(Model)
.Name("Functions")
.Columns(columns =>
{
columns.Bound(o => o.Selected)
.HeaderTemplate(() =>
{
%> <input id="chkAll" type="checkbox" title="check all records" />
<%
})

.ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= Value #>' />")
.Template(o => {
%>
<input name="checkedRecords" type="checkbox" value="<%= o.Value %>"

<%

if (o.Selected) {%> checked="checked" <%%> />

<%}).Title("").Width(36).HtmlAttributes(new {style = "text-align:center"});

columns.Bound(o => o.Text).Title("Document Functions");})

.Footer(false)

.DataBinding(binding => binding.Ajax().Select("GetFunctions""Revision"))

.Scrollable(scrolling => scrolling.Height(50).Enabled(true))

%>

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 19 Aug 2011, 03:01 PM
Hi Denise,

You need to replace the code block
<%= %>
with 
<% %>
and call Grid's Render() method at the end.


Best wishes,
Georgi Tunev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
Denise
Top achievements
Rank 1
answered on 19 Aug 2011, 09:47 PM
Thanks for your answer -- that does work as long I place the grid on the main .ascx page.  I could not use this method by putting the grid on an Editor Template.  Now I have more options.

Tags
Grid
Asked by
Denise
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Denise
Top achievements
Rank 1
Share this question
or