This is a sample program to show TabStrip in Kendo UI.

Gold

Platinum

Table

Steps

Add a Controller

Add controller

Add a View to the Controller.

Index Action Method - Right click and Add View.

Add view

Before designing the Index view add a View Model to the Project named ClsSchemeViewModel.

Right Click Model Folder and Add Class.

Add class

Model class

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace KenCloudClient.Models
  6. {
  7. public class ClsSchemeViewModel
  8. {
  9. public int SchemeId
  10. {
  11. set;
  12. get;
  13. }
  14. public string SchemeName
  15. {
  16. set;
  17. get;
  18. }
  19. public decimal DiscPercentage
  20. {
  21. set;
  22. get;
  23. }
  24. public string SchemeDetails
  25. {
  26. set;
  27. get;
  28. }
  29. }
  30. }
Design the View Page for Index Action
  1. @model KenCloudClient.Models.ClsSchemeViewModel
  2. @{
  3. ViewBag.Title = "Index";
  4. }
  5. <h2>Scheme Details</h2>
  6. <div class="container">
  7. <div class="row">
  8. @(Html.Kendo().TabStrip()
  9. .Name("tabstrip")
  10. .HtmlAttributes(new { style="heigh:300px;width=800px;"})
  11. .Items(tabstrip =>
  12. {
  13. tabstrip.Add().Text("Gold")
  14. .Selected(true)
  15. .Content(@<text>
  16. <div class="col-lg-11" style="float:left;">
  17. @Html.Action("Gold")
  18. </div>
  19. </text>);
  20. tabstrip.Add().Text("Platinum")
  21. .Content(@<text>
  22. <div class="row">
  23. @Html.Action("Platinum")
  24. </div>
  25. </text>);
  26. tabstrip.Add().Text("Enterprise")
  27. .Content(@<text>
  28. <div class="row">
  29. @Html.Action("Enterprise")
  30. </div>
  31. </text>);
  32. })
  33. )
  34. </div>
  35. </div>
  36. <style type="text/css">
  37. #forecast {
  38. width: 360px;
  39. height: 337px;
  40. margin: 30px auto;
  41. padding: 80px 15px 0 15px;
  42. background: url('@Url.Content("~/Content/web/tabstrip/forecast.png")') transparent no-repeat 0 0;
  43. }
  44. .sunny, .cloudy, .rainy {
  45. display: inline-block;
  46. margin: 20px 0 20px 10px;
  47. width: 128px;
  48. height: 128px;
  49. background: url('@Url.Content("~/Content/web/tabstrip/weather.png")') transparent no-repeat 0 0;
  50. }
  51. .cloudy{
  52. background-position: -128px 0;
  53. }
  54. .rainy{
  55. background-position: -256px 0;
  56. }
  57. .weather {
  58. width: 800px;
  59. padding: 40px 0 0 0;
  60. float:left;
  61. }
  62. #forecast h2 {
  63. font-weight: lighter;
  64. font-size: 5em;
  65. padding: 0;
  66. margin: 0;
  67. }
  68. #forecast h2 span {
  69. background: none;
  70. padding-left: 5px;
  71. font-size: .5em;
  72. vertical-align: top;
  73. }
  74. #forecast p {
  75. margin: 0;
  76. padding: 0;
  77. }
  78. </style>
Explanation to the View Page

View Page

At The Controller

Declare ActionResult for Tab Item like Gold, Platinum, and Enterprise.
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using KenCloudClient.Models;
  7. namespace KenCloudClient.Controllers
  8. {
  9. public class SchemeController : Controller
  10. {
  11. ClsSchemeBusiness ClsBusiness = new ClsSchemeBusiness();
  12. // GET: Scheme
  13. public ActionResult Index()
  14. {
  15. return View();
  16. }
  17. public ActionResult Gold()
  18. {
  19. #region -- Action Method for Gold --
  20. var data = ClsBusiness.GetGoldScheme().ToList();
  21. ViewBag.GoldData = data;
  22. return View();
  23. #endregion
  24. }
  25. public ActionResult Platinum()
  26. {
  27. #region -- Action Method For Platinum --
  28. var data = ClsBusiness.GetPlatinumScheme().ToList();
  29. ViewBag.PlatinumData = data;
  30. return View();
  31. #endregion
  32. }
  33. public ActionResult EnterPrise()
  34. {
  35. #region -- Action Method For EnterPrise --
  36. var data = ClsBusiness.GetEnterPriseScheme().ToList();
  37. ViewBag.EnterPriseData = data;
  38. return View();
  39. #endregion
  40. }
  41. }
  42. }
Add three different view pages for the TabPages.

These Views will display inside each TabPages.

Gold.cshtml
  1. @{
  2. Layout = "";
  3. }
  4. <h2>Gold</h2>
  5. <div class="col-lg-7" style=" float:left;">
  6. @{
  7. if (ViewBag.GoldData != null)
  8. {
  9. // Specify the type of the grid
  10. @(Html.Kendo().Grid((IEnumerable<KenCloudClient.Models.ClsSchemeViewModel>)ViewBag.GoldData)
  11. .Name("GoldGrid")
  12. .Columns(columns =>
  13. {
  14. columns.Bound(p => p.SchemeId).Visible(false);
  15. columns.Bound(p => p.SchemeName).Width(200);
  16. columns.Bound(p => p.DiscPercentage).Width(200);
  17. columns.Bound(p => p.SchemeDetails).Width(300);
  18. })
  19. .Pageable()
  20. .Selectable(X => X.Mode(GridSelectionMode.Single))
  21. .Filterable()
  22. .DataSource(data => data.Ajax().PageSize(5).ServerOperation(false))
  23. .Events(ev => ev.Change("onchange"))
  24. )
  25. }
  26. }
  27. </div>
Platinum.cshtml
  1. @{
  2. Layout = "";
  3. }
  4. <h2>Platinum</h2>
  5. <div class="col-lg-7" style=" float:left;">
  6. @{
  7. if (ViewBag.PlatinumData != null)
  8. {
  9. // Specify the type of the grid
  10. @(Html.Kendo().Grid((IEnumerable<KenCloudClient.Models.ClsSchemeViewModel>)ViewBag.PlatinumData)
  11. .Name("PlatinumGrid")
  12. .Columns(columns =>
  13. {
  14. columns.Bound(p => p.SchemeId);
  15. columns.Bound(p => p.SchemeName);
  16. columns.Bound(p => p.DiscPercentage);
  17. columns.Bound(p => p.SchemeDetails);
  18. })
  19. .Pageable()
  20. .Selectable(X => X.Mode(GridSelectionMode.Single))
  21. .Filterable()
  22. .DataSource(data => data.Ajax().PageSize(5).ServerOperation(false))
  23. .Events(ev => ev.Change("onchange"))
  24. )
  25. }
  26. }
  27. </div>
Enterprise.cshtml
  1. @{
  2. Layout = "";
  3. }
  4. <h2>EnterPrise</h2>
  5. <div class="col-lg-7" style=" float:left;">
  6. @{
  7. if (ViewBag.EnterPriseData != null)
  8. {
  9. // Specify the type of the grid
  10. @(Html.Kendo().Grid((IEnumerable<KenCloudClient.Models.ClsSchemeViewModel>)ViewBag.EnterPriseData)
  11. .Name("EnterPriseGrid")
  12. .Columns(columns =>
  13. {
  14. columns.Bound(p => p.SchemeId);
  15. columns.Bound(p => p.SchemeName);
  16. columns.Bound(p => p.DiscPercentage);
  17. columns.Bound(p => p.SchemeDetails);
  18. })
  19. .Pageable()
  20. .Selectable(X => X.Mode(GridSelectionMode.Single))
  21. .Filterable()
  22. .DataSource(data => data.Ajax().PageSize(5).ServerOperation(false))
  23. .Events(ev => ev.Change("onchange"))
  24. )
  25. }
  26. }
  27. </div>
Business Logic Code at ClsSchemeBusiness.cs
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using KenCloudClient.Models;
  6. namespace KenCloudClient.Models
  7. {
  8. public class ClsSchemeBusiness
  9. {
  10. internal List < ClsSchemeViewModel > GetGoldScheme()
  11. {
  12. using(KenClientModel ObjContext = new KenClientModel())
  13. {
  14. var SchemeData = ObjContext.SysSchemes.ToList();
  15. var Temp = (from A in SchemeData where A.SchemeName == "Gold"
  16. select new ClsSchemeViewModel
  17. {
  18. SchemeId = A.SchemeId,
  19. SchemeName = A.SchemeName,
  20. DiscPercentage = Convert.ToDecimal(A.DiscPercentage),
  21. SchemeDetails = A.SchemeDetails
  22. }).ToList();
  23. return Temp;
  24. }
  25. }
  26. internal List < ClsSchemeViewModel > GetPlatinumScheme()
  27. {
  28. using(KenClientModel ObjContext = new KenClientModel())
  29. {
  30. var SchemeData = ObjContext.SysSchemes.ToList();
  31. var Temp = (from A in SchemeData where A.SchemeName == "Platinum "
  32. select new ClsSchemeViewModel
  33. {
  34. SchemeId = A.SchemeId,
  35. SchemeName = A.SchemeName,
  36. DiscPercentage = Convert.ToDecimal(A.DiscPercentage),
  37. SchemeDetails = A.SchemeDetails
  38. }).ToList();
  39. return Temp;
  40. }
  41. }
  42. internal List < ClsSchemeViewModel > GetEnterPriseScheme()
  43. {
  44. using(KenClientModel ObjContext = new KenClientModel())
  45. {
  46. var SchemeData = ObjContext.SysSchemes.ToList();
  47. var Temp = (from A in SchemeData where A.SchemeName == "EnterPrise "
  48. select new ClsSchemeViewModel
  49. {
  50. SchemeId = A.SchemeId,
  51. SchemeName = A.SchemeName,
  52. DiscPercentage = Convert.ToDecimal(A.DiscPercentage),
  53. SchemeDetails = A.SchemeDetails
  54. }).ToList();
  55. return Temp;
  56. }
  57. }
  58. }
  59. }
That is all!
Thank you.