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

Tabstrip and Visible property conflict ?

9 Answers 120 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
IQworks
Top achievements
Rank 1
IQworks asked on 11 Feb 2010, 09:59 PM
  Hi,
    I have a tabstrip that has 3 tabs. 
   "Company Grid"  "Create Company" "Edit Company"

   When the Grid is displayed, it has a link at the bottom to "Create", and, a column on every grid line to "Edit". 

   If I keep the Create and Edit tabs visible. I can click the Create link and the "Create Company" tab area displays with the entry form. If I click on the Edit link of an grid row, the "Edit Company" taba area displays the edit form with the appropriate data to edit. 
   I decided i only wanted the "Create Company" and "Edit Company" tabs to be displayed when I select either the Create or Edit links from the grid. 
   The problem is that when I make both the "Create Company" and "Edit Company" tab Visible property "false", I can use the selected index to display the Create tab and it displays the create form correctly. But when I try to use the selected index to display the "Edit Company" tab and tab area, only the tab displays ? The Edit tab area does not appear with the appropriate or any Edit form. 
   I am not understanding how the Visible property works with the selected index ?
   
  This is the WorkController Index method ... 
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Work.Master" 
 Inherits="System.Web.Mvc.ViewPage"   %> 
 
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">  
    Home Page  
</asp:Content> 
 
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">  
   <h2>Analytics Work Page</h2> 
    
   <% Html.Telerik().TabStrip()  
            .Name("BCAMainTab")  
            .Items(tabstrip => 
            {  
                tabstrip.Add()  
                 .Text("Analytic Data")  
                    /* this tab will be opened initially - no need to get it with ajax */  
                    .Content(() => 
                    {%> 
                        <p> 
                             Select the data you need to maintain or need to check.   
                        </p> 
                    <%});                       
                  
                                      
 
                tabstrip.Add()  
                 .Text("Company")  
                 .HtmlAttributes(new { style="background-color:blue;color:white;" })  
                 .LoadContentFrom("CompanyGrid", "Company");  
 
 
                tabstrip.Add()  
                .Text("Enter Company")  
                .HtmlAttributes(new { style = "background-color:blue;color:white;" })  
                .LoadContentFrom("CompanyCreate", "Company")     
                .Visible((bool)TempData["EntryVisible"]);  
 
 
                tabstrip.Add()  
               .Text("Edit Company")  
               .HtmlAttributes(new { style = "background-color:blue;color:white;" })  
               .LoadContentFrom(Url.Action("CompanyEdit", "Company", new { id = 2 }))   
               .Visible((bool)TempData["EditVisible"]);  
               
                  
            })  
            .SelectedIndex(Convert.ToInt32(TempData["workIndex"]))   
            .Render();  
        %> 
</asp:Content> 
 

  This is the Grid page .... 
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<BCAnalytics.Models.CompanyVM>>" %> 
   <p><%= Html.ActionLink("Close", "Index", "Work", new { workindex = 0 },null)%></p>   
        <%= Html.Telerik().Grid(Model)  
              .Name("CompanyGrid")  
              .Columns(columns => 
                {  
                  //  columns.Add(o => o.cMemberNo).Width(30) ;  
                  //  columns.Add(o => o.cCompanyNo).Width(30);  
                    columns.Add(o => o.cCompanyName).Width(200).Title("Company");  
                    columns.Add(o => o.cEmail).Title("GroupCode");  
                    columns.Add(o => o.cGroupCode).Width(120).Title("Email");  
                    columns.Add(o => o.cDateUpdated).Format("{0:MM/dd/yyyy}").Width(85).Title("Updated");  
                    columns.Add(o => o.cCompanyNo).Format(Html.ActionLink("Edit", "Index", "Work", new {workindex=3,OtherParms"{0}" }, null).ToString()).Encoded(false).Title("").Width(32);  
                    columns.Add(o => o.cCompanyNo).Format(Html.ActionLink("Delete", "CompanyDelete", new { Id = "{0}" }, null).ToString()).Encoded(false).Title("").Width(50);   
                })  
               .Ajax(settings => settings.Action("_AjaxBindingCompany", "Company"))  
               .Pageable()  
               .Sortable(sort => sort.SortMode(GridSortMode.MultipleColumn))  
               .Scrollable(scrolling => scrolling.Height(200))  
               .Filterable() %>            
       <p><%= Html.ActionLink("Create New Company", "Index", "Work", new { workindex = 2OtherParms="" },null)%></p>   
        

  This is the WorkController
   public ActionResult Index(int? workindex, string OtherParms)  
        {  
            TempData["workIndex"] = 0;  
            if(workindex != null)  
            TempData["workIndex"] = workindex;  
 
          
            // Create new Company  
            if (workindex == 2)   
            {  
                TempData["EntryVisible"] = true;  
            }  
            else  
            {  
                TempData["EntryVisible"] = false;  
            }  
 
            // Edit new Company  
            if (workindex == 3)   
            {  
                TempData["EditVisible"] = true;  
                Session["CompanyIdToEdit"] = OtherParms;  
              //  CompanyController ced = new CompanyController();  
               // ViewResult vr = new ViewResult();  
               // vr = (ViewResult)ced.CompanyEdit(Convert.ToInt32(OtherParms));  
              //  return View(vr);  
            }  
            else  
            {  
                TempData["EditVisible"] = false;  
            }  
 
           
            int keytest = Convert.ToInt32(Session["LastKey"]);  
            ViewData["orientation"] = "Horizontal"; // "Vertical";  
            return View();  
        }  
 

Thanks for your time.

   

   

9 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 12 Feb 2010, 11:13 AM
Hello David,

Thank you for drawing our attention to this scenario.
The reason for the described behavior is a incorrect generating of the ID of the contents' divs.

The fix will be included in our next major release. If this issue is a showstopper here is the code patch that you should replace in the NavigationItemContainerExtensions.cs:
public static string GetItemContentId<TComponent, TItem>(this TComponent component, TItem item)
            where TComponent : ViewComponentBase, INavigationItemContainer<TItem>
            where TItem : NavigationItem<TItem>, IContentContainer
        {
            return item.ContentHtmlAttributes.ContainsKey("id") ?
                   "{0}".FormatWith(item.ContentHtmlAttributes["id"].ToString()) :
                   "#{0}-{1}".FormatWith(component.Id, (component.Items.Where(i => i.Visible == true).IndexOf(item) + 1).ToString(Culture.Invariant));
        }

Regards,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
IQworks
Top achievements
Rank 1
answered on 12 Feb 2010, 03:25 PM
Hi Georgi,
    I dont have this NavigationItemContainerExtensions.cs: ?
   When I tried to create it in a new folder call Extensions, I got a couple of errors (see attatchment for the red underlines), since I am a newbie, this is what I coded ....
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
 
namespace BCAnalytics.Extensions  
    {  
    public class NavigationContainerExtensions  
        {  
        }  
 
    public static string GetItemContentId<TComponent, TItem>(this TComponent component, TItem item)  
            where TComponent : ViewComponentBase, INavigationItemContainer<TItem> 
            where TItem : NavigationItem<TItem>, IContentContainer  
        {  
            return item.ContentHtmlAttributes.ContainsKey("id") ?  
                   "{0}".FormatWith(item.ContentHtmlAttributes["id"].ToString()) :  
                   "#{0}-{1}".FormatWith(component.Id, (component.Items.Where(i => i.Visible == true).IndexOf(item) + 1).ToString(Culture.Invariant));  
        }  
 
    } 
  Does this class exists somewhere and i just need to modify it ?  I dont see it, perhaps I need to use a different version ? i am using
2009.3.1320.135.

  thanks again for the fix and your time..
0
IQworks
Top achievements
Rank 1
answered on 12 Feb 2010, 03:33 PM
 Forgot to enclose in the class, sorry. but when i did i still got errors ?  Do you have an example of the complete class ?
0
IQworks
Top achievements
Rank 1
answered on 12 Feb 2010, 03:38 PM
Im rushing this morning - let me slow down .....
here is the screen shot of my NavigationContainersExtention..cs code and what I am getting now.
sorry, thanks again.
0
Georgi Krustev
Telerik team
answered on 17 Feb 2010, 02:52 PM
Hello IQworks,

The code patch that I posted in my last message was for the NavigationItemContainerExtensions.cs file which is placed in the Telerik.Web.Mvc project. This is the project of the Telerik Extensions for the ASP.NET MVC.

For your convenience I have attached latest internal build of the components to this thread.

Best wishes,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
IQworks
Top achievements
Rank 1
answered on 17 Feb 2010, 06:08 PM
 Hi Atanas,
    Thanks for this latest build.
    If I understand correctly, the  NavigationItemContainerExtensions.cs should be in this build. I looked in the Extension source folder, and, in the Telerik.Web.Mvc.dll Extension folder and did not see it ?
   I have enclosed screen shots of both Extension folders - perhaps I am not looking in the right place ?
   Not that I need to see it, I just happened to notice that it was not there.
  
0
Atanas Korchev
Telerik team
answered on 18 Feb 2010, 07:58 AM
Hello IQworks,

The NavigationItemContainerExtensions.cs is in this folder: Telerik.Web.Mvc\UI\NavigationItemContainerExtensions.cs.

However you no longer need to manually patch it as George has sent you a build which incorporates the fix. Use the dll, JavaScript and CSS files (from the Scripts and Content folder) provided in the attached zip file.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
IQworks
Top achievements
Rank 1
answered on 18 Feb 2010, 01:43 PM

Hi Atanas,

   I did try the new build anyway yesterday, just in case the fix was there but I was not seeing it, but it still had the same effect ? 
   I cannot attatch a zip here, but I submitted a support ticket with my code using this new 1417 135 build.
   The support id is - Your ticket ID is : 282929 
   Thanks again.

0
lahyaw galak
Top achievements
Rank 1
answered on 23 Apr 2011, 11:29 PM
is it resolve? i'm using 2011.1.315 and still get conflicted behavior.
Tags
TabStrip
Asked by
IQworks
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
IQworks
Top achievements
Rank 1
Atanas Korchev
Telerik team
lahyaw galak
Top achievements
Rank 1
Share this question
or