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

Grid - Dynamic Column Issue

4 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arithmos Srl
Top achievements
Rank 1
Arithmos Srl asked on 08 May 2015, 09:30 AM

Hi all,

we are implementing a grid using asp.net mvc and aspx pages. We are encountering a couple of problems using templates because it seems

that Visual Studio 2013 does not recognize the object implementation correctly. The error returned by Visual Studio is the CS1525:Invalid expression term ')'..  This is our code with the comments..

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteEnvironment.Master" Inherits="System.Web.Mvc.ViewPage<MyApp.Models.EnvTblModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Environment List</h2>
<%:
Html.Kendo().Grid<MyApp.Models.EnvTblModel>()
    .Name("Grid")
    .BindTo((IEnumerable<MyApp.Models.EnvTblModel>)ViewBag.EnvironmentList)
    .Columns(colList =>
        {

            foreach (var runCol in ViewBag.colSchLst)
            {  

colList.Bound(runCol.TBS_BOUND_FIELD_NAME).Title(runCol.TBS_COLUMN_NAME);
            }
            colList.Bound(p =>
p.TBG_FILLER_CHK01).Template(p =>
            {       /*VISUAL STUDIO GIVES THE ERROR CS1525: Invalid expression term ')' HERE .. */
                %>
                    <strong><%: p.TBG_FILLER_CHK01 %></strong>   //THIS BLOCK SEEMS NOT RECOGNIZED 
                <%
            });
        });
%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>

 

Thank you in advance for your help..

 

Regards

 

 

 

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 12 May 2015, 06:42 AM

Hello Arithmos,

When using server templates in WebForms rendering engine, it will be required to use the Render method as shown in the documentation here.

<%
Html.Kendo().Grid<MyApp.Models.EnvTblModel>()
    .Name("Grid")
    .BindTo((IEnumerable<MyApp.Models.EnvTblModel>)ViewBag.EnvironmentList)
    .Columns(colList =>
        {
            foreach (var runCol in ViewBag.colSchLst)
            {  
colList.Bound(runCol.TBS_BOUND_FIELD_NAME).Title(runCol.TBS_COLUMN_NAME);
            }
            colList.Bound(p =>
p.TBG_FILLER_CHK01).Template(p =>
            {       /*VISUAL STUDIO GIVES THE ERROR CS1525: Invalid expression term ')' HERE .. */
                %>
                    <strong><%: p.TBG_FILLER_CHK01 %></strong>   //THIS BLOCK SEEMS NOT RECOGNIZED 
                <%
            });
        }).Render();
%>

 

Regards,
Rosen
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Arithmos Srl
Top achievements
Rank 1
answered on 13 May 2015, 07:46 AM
Thanks Rosen, it perfectly works!

What's the difference from this "<%" and this one "<%:" ?

I've seen that the last one is not declared in the "Introduction to ASP.NET Inline expressions in the .NET Framework", is this just for Telerik?
0
Arithmos Srl
Top achievements
Rank 1
answered on 13 May 2015, 07:46 AM
Thanks Rosen, it perfectly works!

What's the difference from this "<%" and this one "<%:" ?

I've seen that the last one is not declared in the "Introduction to ASP.NET Inline expressions in the .NET Framework", is this just for Telerik?
0
Rosen
Telerik team
answered on 13 May 2015, 09:27 AM

Hello Arithmos Srl,

No, this is  not a telerik specific but a built-in code expression syntax. It is similar to the <%= but applies html encoding. It is missing from the article you are referring to as it applies to an older versions of the framework. Here you can find an article which talks about this code expression.

Regards,
Rosen
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Arithmos Srl
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Arithmos Srl
Top achievements
Rank 1
Share this question
or