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 7588625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:58:08+00:00 2026-05-30T19:58:08+00:00

I am using Telerik’s MVC Grid in my project which really is good. Unfortunately

  • 0

I am using Telerik’s MVC Grid in my project which really is good. Unfortunately I am stuck at last.. The problem is that I want to show a collection inside a column. The collection is a property of my user model. Here is the sample code:

{...}    
    .Columns(columns =>
    {
        columns.Bound(u => u.Id).Title("No.").Width(100);
        columns.Bound(u => u.UserName).Title("User Name");
        columns.Bound(u => u.CompanyName).Title("Company Adı");
        columns.Template(u =>
            {
                foreach(var item in u.Roles)
                {

                }
            }).Title("Roller");
        columns.Command(commands => 
            {                    
                commands.Custom("viewDetails")
                .Text("Detail")
                .DataRouteValues(route => route.Add(o => o.Id).RouteKey("UserAccountId"))
                .Ajax(false)
                .Action("UserAccountRead", "Account");
                commands.Delete().ButtonType(GridButtonType.ImageAndText);
            })
        .Width(200);
    })
    .Sortable()
    .Pageable(paging => paging.PageSize(10))
    .Localizable("en-EN")
    ) 
{...}

In the foreach loop I’ve tried many things to display user roles, but haven’t succeed.

@item.Name
I Got : Error: Only assignment, call, increment, decrement and new object expressions can be used as a statement

@:<text>@item.Name</text>
I Got: ; required

And so on… What should I write as a statement for just making the column to show user roles?

  • 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-30T19:58:09+00:00Added an answer on May 30, 2026 at 7:58 pm

    You can add a ReadOnly property to your model which returns a simplified formatted text for you. for example you :

       partial class MyModel{
           public string RolesAsString
           {
              get{
                    string result="";
                    foreach(var item in this.Roles)
                    {
                         result += string.format("{0},",item);
                    }
                    return result.trim(",");
    
              }
           }
    
    
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Telerik grid for mvc project , I want drop down list
Hi I am Using Telerik MVC Grid Control in my MVC 3.0 Project I
Using a Telerik Grid with ASP.NET MVC 3 Razor engine. When a user selects
I have a project I'm working on and I'm using the Telerik MVC controls.
I am using Telerik MVC grid ajax binding to show some records. While the
I am using Telerik asp.net mvc extensions. I have an issue that happens only
I am using Telerik MVC Grid, with ajax binding and I use grid editing
I have been using telerik extensions for an asp.net mvc project, more specifically the
i am using telerik grid in my Asp.Net MVC3 application and i want to
I'm using telerik ASP.Net Ajax grid component, and I'm facing a problem. If I'm

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.