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

[Solved] DetailView ClientTemplate with '

4 Answers 157 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.
kobo33
Top achievements
Rank 1
kobo33 asked on 29 Aug 2010, 09:43 AM
Hi all
I have this problem with DetailView ClientTemplate strings
This code demonstrate the problem, what am i doing wrong ?
<%= Html.Telerik().Grid<EmployeeViewModel>()
        .Name("Employees")        
        .Columns(columns =>        
        {            
        columns.Bound(e => e.FirstName).Width(140);
             columns.Bound(o => o.SomeStringID)
                        .Width(101);
                        columns.Bound(o => o.SomeBoolValue)
//Create working JS call
                        .ClientTemplate("<input type'checkbox' value=<#= SomeBoolValue #> onchange='JSFunction('\"<#= SomeStringID #>\", this.checked' />")
                        .Width(101);
  
        })        
.ClientEvents(events => events.OnRowDataBound("employees_onRowDataBound"))
        .DetailView(details => details.ClientTemplate(
                Html.Telerik().Grid<OrderViewModel>()
                    .Name("Orders_<#= EmployeeID #>")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.SomeStringID)
                        .Width(101);
                        columns.Bound(o => o.SomeBoolValue)
//Create a none working JS call
                        .ClientTemplate("<input type'checkbox' value=<#= SomeBoolValue #> onchange='JSFunction('\"<#= SomeStringID #>\", this.checked' />")
                        .Width(101);
                          
                    })
...

Thanks
Kobo

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 30 Aug 2010, 07:48 AM
Hello kobo33,

The template you are setting is not valid. Try with this:

"<input type='checkbox' value='<#= SomeBoolValue #>' onchange='JSFunction(\"<#= SomeStringID #>\", this.checked)' />"

Also make sure you are using the latest official version 2010.2.825. There are known issues with the previous release.

Regards,
Atanas Korchev
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
kobo33
Top achievements
Rank 1
answered on 30 Aug 2010, 09:09 AM
Hi Atanas 
I'm using the 2010.2.825 version.
The problem is in the marked \", when removing them the js call build correctly but will not work because of the lack of Quotation mark.
when adding them the html generated is not valid.

* I also tried changing the \" to ' with no success


"<input type='checkbox' value='<#= SomeBoolValue #>' onchange='JSFunction(\"<#= SomeStringID #>\", this.checked);' />"


Thanks 
Kobo
0
Atanas Korchev
Telerik team
answered on 30 Aug 2010, 09:53 AM
Hello kobo33,

I cannot reproduce this problem locally. I will need a sample project showing the problem.

Regards,
Atanas Korchev
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
Rafael
Top achievements
Rank 1
answered on 17 Sep 2010, 02:56 PM
Try this code: it works fine for me
columns.Bound(p => p.IsForcast).Visible(true).Title("Is Forecast").Width(150).ClientTemplate("<input type='checkbox' name='chkForecast'  <#= IsForcast? \"checked='checked'\" : \"\" #> /> ").HtmlAttributes(new { style = "text-align:center" }); 
Tags
Grid
Asked by
kobo33
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
kobo33
Top achievements
Rank 1
Rafael
Top achievements
Rank 1
Share this question
or