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

[Solved] Correct placement of telerik extensions ?

3 Answers 81 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 12 Feb 2010, 07:37 PM
Hi,
   Sorry to double post, but this might need to be in another post.
   Refering to this post Tabstrp Visible property conflicting with selectedindex , I was given a method for a fix.
   The instructions make me think that a NavigationItemContainerExtensions.csProgram exist somewhere to apply this method ...
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));  
        }  
 
 just not sure where this .cs exists so I can add the above code ?
I looked in the telerik web.mvc.dll and saw the extensions namespace, but did not see the NavigationItemContainerExtensions.cs: ?  .
should i create an extensions folder and then create this class and add the methods ?
thanks for your time again.
 

3 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 12 Feb 2010, 08:22 PM
Ok, i tried to create the class like this ....
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using Telerik.Web.Mvc.UI;  
using Telerik.Web.Mvc.Extensions;  
 
namespace BCAnalytics.Extensions   
{  
     
    public static class NavigationItemContainerExtensions  
    {  
           
        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));  
        }  
 
    }  
}  
 

This line gives me errors .... 

 

"#{0}-{1}".FormatWith(component.Id, (component.Items.Where(i => i.Visible == true).IndexOf(item) + 1).ToString(Culture.Invariant));
Its says for indexOf ... 
Error 1 'System.Collections.Generic.IEnumerable<TItem>' does not contain a definition for 'IndexOf' and no extension method 'IndexOf' accepting a first argument of type 'System.Collections.Generic.IEnumerable<TItem>' could be found (are you missing a using directive or an assembly reference?) C:\IQSys\BCAnalytics\BCAnalytics\Extensions\NavigationItemContainerExtensions.cs 20 103 BCAnalytics
Error 3 'Telerik.Web.Mvc.Extensions.EnumerableExtensions.IndexOf(System.Collections.IEnumerable, object)' is inaccessible due to its protection level C:\IQSys\BCAnalytics\BCAnalytics\Extensions\NavigationItemContainerExtensions.cs 20 103 BCAnalytics

Then, for Culture it says ... 
Error 4 The name 'Culture' does not exist in the current context C:\IQSys\BCAnalytics\BCAnalytics\Extensions\NavigationItemContainerExtensions.cs 20 131 BCAnalytics

I guess I am sort of stuck here ?

 

0
IQworks
Top achievements
Rank 1
answered on 16 Feb 2010, 03:12 AM
  Perhaps I misunderstood ? 
  Should I be waiting for the version with this fix in it ? 
  Or am I just applying the fix incorrectly ?

  thanks for your time.
0
Georgi Krustev
Telerik team
answered on 17 Feb 2010, 02:54 PM
Hi IQworks,

I have answered you this forum thread.

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.
Tags
TabStrip
Asked by
IQworks
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or