Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6566455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:13:09+00:00 2026-05-25T14:13:09+00:00

I’m trying to set up a Master/Detail grid using the Grid control from Telerik’s

  • 0

I’m trying to set up a Master/Detail grid using the Grid control from Telerik’s Extensions for ASP.NET MVC. My problem is setting up the server template.

The demo I’m following is the first one on this page, except I’m using Razor View Engine.

I have the grid displaying fine. The problem is that I cannot write any sort of a server template that doesn’t throw a compiler error – aside from leaving it blank!

@(Html.Telerik().Grid(Model)
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Bound(o => o.Date).Format("{0:MM/dd/yyyy}").Width(100);
                columns.Bound(o => o.Title).Template(@<text> <a href="/Media/@item.Slug">@item.Title</a></text>).Sortable(false);
                columns.Bound(o => o.Publication).Width(120).Sortable(false);
            })
            .DetailView(detailView => detailView.Template(e =>
            {
                //Anything other than this comment will throw a compiler error
            }))
            .RowAction(row =>
            {
                // Expand initially the detail view of the first row
                if (row.Index == 0)
                {
                    row.DetailRow.Expanded = true;
                }
            })
            .Sortable()
            .Scrollable(scrolling => scrolling.Height(494)).Footer(false)
            .ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
        )

See that comment “anything other than this comment…”? When I replace that with something like @<text> hello</text>, I get a compilation error:

CS1002: ; expected

That doesn’t seem to make sense, but I humour myself and put a semicolon in like such @<text> hello</text>;. That gives me this error:

CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

When I replace that with a portion of the template I really want, namely @<text><b>Slug</b>: @item.Slug</text>, I get the same errors; CS1002 with no semicolon, and CS0201 with a semicolon.

What am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:13:10+00:00Added an answer on May 25, 2026 at 2:13 pm

    There are two ways you can approach this. If you just want to display some simple text and not really integrate any other components it would be the easiest to modify the code you have above to just do this:

    .DetailView(detailView => detailView.Template(@<text>test</text>))
    

    As you can see I removed the whole e => { … } part and just put in @<text></text>.

    However, if you want to look into getting more components in your detail view I think it would be better to look at the demo found here. Although the description mentions some WebForms code you don’t need to worry, the rest is all in Razor 🙂 It also explains things you have to keep in mind. One of the most important ones is that any components within the DetailTemplate will have to use { … } as opposed to ( … ) this is because you want to specifically call .Render(); (using the ( … ) implicitly calls .Render but at the wrong point for these scenarios) at the end of those components’ declaration to make sure they are all rendered correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.