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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:36:53+00:00 2026-06-06T13:36:53+00:00

I know there is a question about conditional DetailView, I however feel that’s not

  • 0

I know there is a question about conditional DetailView, I however feel that’s not what I’m looking for. I’ve been messing around with the Telerik Grid for MVC, and I’ve managed to create a DetailView for my rows in my grid. The thing is as of now, my DetailView is filled with HTML-code, and I want to have a new model inside.

Based on one columns value, I want to create a DetailView only for rows matching that columns value. So, for instance, if Column “Type” equals Fruit, it shall create a DetailView for it (with the “+” sign). Now if “Type” is Vegetable, it should not create the DetailView (without the “+” sign).

My current code looks like this:

Html.Telerik().Grid<SearchViewModel>(Model)
        .Name("Search")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.Type).Width(60);
                        //etc.
                    })
        //.PrefixUrlParameters(false)
        .DetailView(detailView => detailView.ClientTemplate(
            "<div>" +
            "<h5><span>Details for Type:</span></h5><div><#= DetailsType #></div>" +
            "</div>"
        ))

As you can see, I’m create the DetailView for every row in my grid.

Also, I’ve found a JavaScript that hides the plussign for certain conditions, it however doesn’t work on initial load (only after I’ve made a filtering, paging or refresh request).The Script is bound with the .OnRowDataBound.

function hidePlusSign(e) {
    var row = e.row;
    var dataItem = e.dataItem;

    if (dataItem.Type != "Fruit") {
        $('a.t-icon', e.row.cells).css('display', 'none');

    }
  • 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-06-06T13:36:55+00:00Added an answer on June 6, 2026 at 1:36 pm

    What you need to do just add condition in your detail view, its look like this:

    "<# if (DetailsType == 'MyType') { #>" +    
        "<div>some html code here</div>" +
    "<# } else { #>" +
        "<div>another html code here</div>" +
    "<# } #>" +
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there is a question about that, but there isn't any good answer(for
I know there's a lot of questions about this but I've been struggling with
NOTE: I know there are many questions that talked about that but I'm still
I know that there are many different questions about this sort of topic on
I know there is such a question on SO, but I could not find
I know there was already a question about this topic (cleanest way to add
I have a question about Apache Commons projects . We know there are many
i know there are several questions about regex recursion in .net. I can write
I know there are dozens of questions on different sites about this issue. I
I know there is a very similar question here but I was hoping to

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.