TabString not changing tab (RAZOR)

1 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Oct 2013

    Posted 30 Oct 2013 Link to this post

    // ASP.NET MVC
    Hello,


    I have a problem with my tab, when I click on any other tab change this.
    What's weird is that my tab works in the home page but not in another page "Parameter"
    I just picked up the code on your site regarding tab.
    I will put the screen and the code copies.

    Thank you for your help

    ParameterView:

    @using System.Globalization
    @using Telerik.Web.Mvc.UI
     
     
    @{ Html.Telerik().TabStrip()
            .Name("TabStrip")
            .Items(tabstrip =>
            {
                tabstrip.Add()
                    .Text("ASP.NET MVC")
                    .ImageUrl("~/Content/Common/Icons/Suites/mvc.png")
                    .Content(@<text>
                        <ul>
                            <li>Pure ASP.NET MVC components</li>
                            <li>Completely Open Source</li>
                            <li>Exceptional Performance</li>
                            <li>Based on jQuery</li>
                            <li>Search Engine Optimized</li>
                            <li>Cross-browser support</li>
                        </ul>
                    </text>);
                tabstrip.Add()
                    .Text("Silverlight")
                    .ImageUrl("~/Content/Common/Icons/Suites/sl.png")
                    .Content(@<text>
                        <ul>
                            <li>Built on Silverlight 3</li>
                            <li>RIA services support</li>
                            <li>Validation support</li>
                            <li>Out of browser support</li>
                            <li>The first commercial 3D chart</li>
                            <li>Free testing framework</li>
                        </ul>
                    </text>);
                tabstrip.Add()
                    .Text("ASP.NET AJAX")
                    .ImageUrl("~/Content/Common/Icons/Suites/ajax.png")
                    .Content(@<text>
                        <ul>
                            <li>Built on top of Microsoft ASP.NET AJAX framework</li>
                            <li>Rich client-side capabilities; nearly identical client-side and server-side APIs</li>
                            <li>.NET 3.5 built-in support for LINQ, EntityDataSource, ADO.NET DataServices, WCF, etc</li>
                            <li>Performance optimization helper controls and HTTP compression</li>
                            <li>SharePoint and DotNetNuke Integration; ASP.NET MVC-ready</li>
                            <li>Wide cross-browser compatible and XHTML compliant</li>
                        </ul>
                    </text>);
                tabstrip.Add()
                    .Text("OpenAccess ORM")
                    .ImageUrl("~/Content/Common/Icons/Suites/orm.png")
                    .Content(@<text>
                        <ul>
                            <li>Model First and Schema First approaches</li>
                            <li>Stored Procedures for Multiple Databases</li>
                            <li>Views for Multiple Databases</li>
                            <li>Generic Metadata Access and artificial fields API in the runtime</li>
                            <li>Support for Ado.Net Data Services and WCF</li>
                            <li>Support for LINQ, OQL, and SQL Languages</li>
                        </ul>
                    </text>);
                tabstrip.Add()
                    .Text("Reporting")
                    .ImageUrl("~/Content/Common/Icons/Suites/rep.png")
                    .Content(@<text>
                        <ul>
                            <li>Excellent data presentation and analysis: Crosstabs, Charts, Tables, Lists</li>
                            <li>SubReports, Barcodes, Images, Shapes, and more</li>
                            <li>Revolutionary WYSIWYG design surface in Visual Studio</li>
                            <li>Easy conditional formatting, sorting, filtering, grouping</li>
                            <li>Powerful styling, data binging and data processing models</li>
                            <li>Significantly reduced development time through wizards and builders</li>
                        </ul>
                    </text>);
                tabstrip.Add()
                    .Text("Sitefinity ASP.NET CMS")
                    .ImageUrl("~/Content/Common/Icons/Suites/sitefinity.png")
                    .Content(@<text>
                        <ul>
                            <li>Multi-lingual Content Integration</li>
                            <li>Workflow Engine</li>
                            <li>Document versioning</li>
                            <li>Permissions</li>
                            <li>Interface Localization</li>
                            <li>Wide cross-browser compatible and XHTML compliant</li>
                        </ul>
                    </text>);
            })
            .SelectedIndex(0)
            .Render();
    }


    GridControler:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
     
    namespace WebRH2012.Controllers
    {
        using System.Linq;
        using System.Web.Mvc;
     
        using Models;
        using System;
        using Telerik.Web.Mvc.UI;
        using Telerik.Web.Mvc;
        using System.Data.Entity.Validation;
        public partial class GridController : Controller
        {
            //[SourceCodeFile("EditableProduct (model)", "~/Models/EditableProduct.cs")]
            //[SourceCodeFile("SessionProductRepository", "~/Models/SessionProductRepository.cs")]
            //[SourceCodeFile("Date.ascx (editor)", "~/Views/Shared/EditorTemplates/Date.ascx")]
            private readonly JSIEntities context = new JSIEntities();
            public ActionResult ForeignKeyColumn()
            {
     
     
                return View(new GridModel(Statut.getAllStatut()));
            }
            [GridAction]
            public ActionResult _ForeignKeyColumn()
            {
                return View(new GridModel(Statut.getAllStatut()));
            }
            [AcceptVerbs(HttpVerbs.Post)]
            [GridAction]
            public ActionResult _ForeignKeyColumnUpdateOrder(int id, int employeeId)
            {
     
                //var order = new ClientEditableOrder
                //{
                //    OrderID = id,
                //    Employee = new NorthwindDataContext().Employees
                //            .Where(e => e.EmployeeID == employeeId)
                //            .Select(e => e.FirstName + " " + e.LastName).SingleOrDefault()
                //};
                //// Exclude "Employee" from the list of updated properties
                //if (TryUpdateModel(order, null, null, new[] { "Employee" }))
                //{
                //    SessionClientOrderRepository.Update(order);
                //}
                return View(new GridModel(Statut.getAllStatut()));
            }
     
     
     
            public ActionResult EditingAjax(GridEditMode? mode, GridButtonType? type, GridInsertRowPosition?
                insertRowPosition)
            {
                ViewData["mode"] = mode ?? GridEditMode.InLine;
                ViewData["type"] = type ?? GridButtonType.Text;
                ViewData["insertRowPosition"] = insertRowPosition ?? GridInsertRowPosition.Top;
                return View();
            }
            [GridAction]
            public ActionResult _SelectAjaxEditing()
            {
                //return View(new GridModel(SessionProductRepository.All()));
                return null;
            }
            //[AcceptVerbs(HttpVerbs.Post)]
            //[CultureAwareAction]
            //[GridAction]
            //public ActionResult _SaveAjaxEditing(int id)
            //{
            //    EditableProduct product = SessionProductRepository.One(p => p.ProductID == id);
     
            //    TryUpdateModel(product);
            //    SessionProductRepository.Update(product);
            //    return View(new GridModel(SessionProductRepository.All()));
            //}
            [AcceptVerbs(HttpVerbs.Post)]
            //[CultureAwareAction]
            [GridAction]
            public ActionResult _InsertAjaxEditing(FormCollection form, string entityName, int id)
            {
     
                var result = new object();
     
                var newObject = new object();
                var model = new GridModel();
     
     
                switch (entityName)
                {
     
                    case "augmentations":
     
                        newObject = AUGMENTATIONS.FormCollectionToAugmentations(form, id);
                        //((AUGMENTATIONS)newObject).REF_CANDIDAT = id;
                        if (TryValidateModel((AUGMENTATIONS)newObject))
                        {
     
                            context.AUGMENTATIONS.Add(((AUGMENTATIONS)newObject));
                            context.SaveChanges();
     
     
                        }
                        model = new GridModel(CANDIDATS.getCandidatByID(id, context).getHistoAugmention());
                        break;
                    case "corange":
                        newObject = HISTO_MT_CARTE_ORANGE_CANDIDAT.FormCollectionToHistoMtCorange(form, id);
                        //((HISTO_MT_CARTE_ORANGE_CANDIDAT)newObject).REF_CANDIDAT = id;
                        if (TryValidateModel((HISTO_MT_CARTE_ORANGE_CANDIDAT)newObject))
                        {
     
                            context.HISTO_MT_CARTE_ORANGE_CANDIDAT.Add(((HISTO_MT_CARTE_ORANGE_CANDIDAT)newObject));
                            context.SaveChanges();
     
     
                        }
                        model = new GridModel(CANDIDATS.getCandidatByID(id, context).getHistoCorange());
                        break;
                    case "ndf":
                        newObject = CANDIDATS_NDF.FormCollectionToHistoMtCorange(form, id);
                        if (TryValidateModel((CANDIDATS_NDF)newObject))
                        {
                            context.CANDIDATS_NDF.Add(((CANDIDATS_NDF)newObject));
                            context.SaveChanges();
                        }
                        model = new GridModel(CANDIDATS.getCandidatByID(id, context).getHistoNdf());
                        break;
                    case "primes":
                        newObject = PRIMES.FormCollectionToHistoMtCorange(form, id);
                        if (TryValidateModel((PRIMES)newObject))
                        {
                            context.PRIMES.Add(((PRIMES)newObject));
                            context.SaveChanges();
                        }
                        model = new GridModel(CANDIDATS.getCandidatByID(id, context).getHistoPrime());
                        break;
                }
                return View(model);
     
     
     
                //Create a new instance of the EditableProduct class.
                //EditableProduct product = new EditableProduct();
                //Perform model binding (fill the product properties and validate it).
                //if (TryUpdateModel(product))
                //{
                //    //The model is valid - insert the product.
                //    SessionProductRepository.Insert(product);
                //}
                ////Rebind the grid
                //return View(new GridModel(SessionProductRepository.All()));
     
            }
            //[AcceptVerbs(HttpVerbs.Post)]
            //[GridAction]
            //public ActionResult _DeleteAjaxEditing(int id)
            //{
            //    //Find a customer with ProductID equal to the id action parameter
            //    EditableProduct product = SessionProductRepository.One(p => p.ProductID == id);
            //    if (product != null)
            //    {
            //        //Delete the record
            //        SessionProductRepository.Delete(product);
            //    }
     
            //    //Rebind the grid
            //    return View(new GridModel(SessionProductRepository.All()));
            //}
        }
    }


    Layout:

    <!DOCTYPE html>
    <html>
    <head>
        <title>Outil RH </title>
        <meta http-equiv="X-UA-Compatible" content="IE=100" />
        <meta http-equiv="Content-Type" content="text/html; CHARSET=UTF-8 " />
        <link href="@Url.Content("../../Content/jquery.contextMenu.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("../../Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("../../Content/StyleGridView.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("../../Content/StyleRH.css")" rel="stylesheet" type="text/css" />
        <script src="@Url.Content("../../Scripts/jquery-1.7.2.min.js")"></script>
        @*    <script src="@Url.Content("../../Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>*@
         
        <script src="@Url.Content("../../Scripts/jquery.ui.core.js")" type="text/javascript"></script>
        <script src="../../Scripts/jquery.ui.widget.js"></script>
        <script src="@Url.Content("../../Scripts/jquery.ui.tabs.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery.editable-1.3.3.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/Script.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery.contextMenu.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery.validate.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("../../Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
        <link href="@Url.Content("../../Content/2013.2.611/telerik.common.min.css")" rel="stylesheet" />
        <link href="@Url.Content("../../Content/2013.2.611/telerik.vista.min.css")" rel="stylesheet" />
        <link href="@Url.Content("../../Content/2013.2.611/telerik.rtl.min.css")" rel="stylesheet" />
     
        <script type="text/javascript">
            $(document).ready(function () {
                if (window.location.search.length == 0) {
                    if ($("#All_Candidats").val() < 1)
                        $(".MenuInfo").hide("fast", function () { $(".MenuInfo").css("height", "0"); });
                }
            });
     
        </script>
     
     
        <base target="_self" />
    </head>
    <body>
        <div id="Contenu">
            @Html.Partial("header")
            @RenderBody()
            <div id="footer">
            </div>
        </div>
    </body>
    </html>
Back to Top