# Using a Switch Case in Client Template

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>ListView for Progress® Telerik® UI for ASP.NET Core</td>
 </tr>
 <tr>
  <td>Product Version</td>
  <td>2019.1.220</td>
 </tr>
 <tr>
  <td>ASP.NET Core Version</td>
  <td>2.2</td>
 </tr>
</table>

## Description

I am just starting to utilize the list view for .net core. I have not determined if possible to dynamically set the template based upon a condition, I am trying to base the condition on a ViewBag property. I know the ViewBag value is available in the template because I can show its value in a div. However, I am not sure if it is possible to use in an if or switch condition, and if it is possible, what syntax I should use?

## Solution

You can set the template dynamically with the help of the [Kendo UI Template](https://docs.telerik.com/kendo-ui/framework/templates/overview) by adding conditions in the template or using functions:

```
    <script type="text/x-kendo-tmpl" id="template">
        # switch ("@ViewBag.SurveyType") {
            case "PolyGraph Examiner": #
            <div class="yellow">
                <h3>#= OrderID #</h3>
            </div>
            # break; #
 
            #case "B": #
            <div class="yellow">
                <h3>#= OrderID #</h3>
            </div>
            # break;} #
    </script>

```

## More ASP.NET MVC Resources

* [Telerik UI for ASP.NET MVC Documentation](https://www.telerik.com/aspnet-mvc/documentation/introduction)

* [Telerik UI for ASP.NET MVC Demos](https://demos.telerik.com/aspnet-mvc)

* [Telerik UI for ASP.NET MVC Product Page](https://www.telerik.com/aspnet-mvc)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
