Use variable for ClientDetailTemplateId name

3 posts, 0 answers
  1. Shawn
    Shawn avatar
    50 posts
    Member since:
    Jul 2016

    Posted 08 Dec 2016 Link to this post

    Hi,

    Can you use a variable or a Session["variable"] as the ClientDetailTemplateId value? Or does it have to be a hard-coded string? I would like to be able to control the displaying of the detail template based on a user profile setting.  If the user is not allowed to see the details, I'd like to set a variable (or session cookie/variable) to an empty string, otherwise set it to the detail template name.

    I already have the detail template working, but would now like to control whether or not it is displayed. When I change the name to an empty string "", the details template does not get displayed, so if I can use a variable for this name, I should be able to get my desired result.

    Thanks,
    Shawn

  2. Eyup
    Admin
    Eyup avatar
    4076 posts

    Posted 12 Dec 2016 Link to this post

    Hi Shawn,

    Generally, you can check these resources for common knowledge:
    http://www.telerik.com/forums/clientdetailtemplateid-and-id-of-parent
    http://stackoverflow.com/questions/13453288/kendo-ui-grid-different-detail-templates-depending-on-condition

    Or you can define some variable and try to get it from the ViewBar or ViewData:
    @{
        var gridname1 = "grid1";
    }
     
    @(Html.Kendo().Grid<WebApplication1.Models.ProductViewModel>()
        .Name(@gridname1)
     
    I hope this will prove helpful. If you have different requirements or further instructions, please elaborate on your specific scenario.


    Regards,
    Eyup
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
  3. Shawn
    Shawn avatar
    50 posts
    Member since:
    Jul 2016

    Posted 12 Dec 2016 in reply to Eyup Link to this post

    Eyup,

    Thanks so much for that reply.  I knew it had to be a simple solution.  My search text just did not bring up those links you listed.  All sorted now.

    Shawn

Back to Top