This is a migrated thread and some comments may be shown as answers.

Use variable for ClientDetailTemplateId name

2 Answers 441 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 08 Dec 2016, 09:10 AM

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 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 12 Dec 2016, 06:03 AM
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.
0
Shawn
Top achievements
Rank 1
answered on 12 Dec 2016, 10:32 AM

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

Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or