0

I have a problem with rendering a mvc telerik template grid control. Every thing seems fine but I have this error:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

Source Error:

Line 14:
Line 15:
Line 16:
}).Width(100); Line 17: columns.Bound(p => p.ProductName).Title("Product"); Line 18: columns.Bound(p => p.WholesalePrice).Title("Price");

here is my source code:

@(
        Html.Telerik().Grid(Model)
        .Name("grid")
        .DataKeys(key => key.Add(p => p.ID))
        .Columns(columns =>
                     {
                         columns.Template(p =>
                                              {
                                                  @<div> 
                                                       <img alt="@p.ProductName"src="@p.ImageURL" />
                                                   </div>
                                              }).Width(100);
                         columns.Bound(p => p.ProductName).Title("Product");
                         columns.Bound(p => p.WholesalePrice).Title("Price");
                     })
        .Pageable()
        .Groupable()
        .Sortable()
)

without defining the column template everything seems to work fine.

1 Answer 1

3

Try:

@(
    Html.Telerik().Grid(Model).Name("grid")
        .Columns( columns =>
                      {
                          columns.Template(
                              @<text> bla bla </text>
                          );
                          columns.Bound(p => p.ProductName).Title("Product");
                      }).Pageable().Sortable()
)
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, this works. however I need to display a grid with images. do you know what wrong with the code that i've edited

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.