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

[Solved] Bug with DetailView with nested control Name property

2 Answers 65 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.
leblanc
Top achievements
Rank 1
leblanc asked on 18 Feb 2013, 01:37 AM
The following works:

    .DetailView(details=>
        details.ClientTemplate(
            Html.Telerik().TabStrip()
                .Name("_Grid_TabStrip_Post_<#= Id #>")

However if i introduce 1 level of nesting like:

    .DetailView(details=>
        details.ClientTemplate(
            Html.Telerik().TabStrip()
                .Name("_Grid_TabStrip_Post_<#= Model.Id #>")

I get a javascript error when it tries to apply the tabstrip behavior.  The generated code creates a syntax error due to escape sequence.
$('#_Grid_TabStrip_Post_' + Model\\.Id)




Applying to route data Model.Id works so why wouldn't this be supported in .Name(....) ?
                    items.Add().Text("Details")
                            .LoadContentFrom("_Details", "Post", new { Id = "<#= Model.Id #>" });


We are planning to upgrade to kendo ui Q1 2013 when it gets released in march.  Did kendo inherit this problem also?

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Feb 2013, 08:28 AM
Hello,

The difference with the URL is that the dot is unallowed character for an ID. Thus it needs to be escaped which will also make the template not valid. The same problem will occur in Kendo. In order to avoid this you could use a view model which does not use complex type for the property.

Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
leblanc
Top achievements
Rank 1
answered on 22 Feb 2013, 04:19 AM
I understand about viewmodels.  My goal was to  reduce complexity on what's code generated (more code to maintain - when it is a copy of the poco ef object)  t4scaffolding


 public class GridViewModel<T>
 {
  public T Model { get; set; }
 
  [ScaffoldColumn(false)]
  public bool IsSelected { get; set; }
 }

I guess there is not a way around this so i'll code generate the viewmodel and be done with it.


Tags
Grid
Asked by
leblanc
Top achievements
Rank 1
Answers by
Daniel
Telerik team
leblanc
Top achievements
Rank 1
Share this question
or