+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / how to display particular list details as tabstrip/multipage view

how to display particular list details as tabstrip/multipage view

9 posts, 0 answered
  1. amar koli
    amar koli avatar
    19 posts
    Registered:
    19 Feb 2010
    12 Mar 2010
    Link to this post
    Hi
    I tried the example given here
    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/tabstrip-multipage-vs-lists.aspx

    but what i want is to display a particular list as tabstrip/multipage
    suppose say i have a list defined as "Products" and there are 4/5 list items with description of each item. I want the list items as the tabs and its description in the multipage view.
    How can i do this, please guide me on this.

    Thanks

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Mar 2010
    Link to this post
    Hello amar koli,

    The implementation is very basic. You have to crate an user control

    <telerik:RadTabStrip runat="server" ID="RadTabStrip1" MultiPageID="RadMultiPage1"></telerik:RadTabStrip>
    <telerik:RadMultiPage runat="server" ID="RadMultiPage1" OnPageViewCreated="RadMultiPage1_PageViewCreated" SelectedIndex="0" ></telerik:RadMultiPage>

    and its code behind get an INamedList and then all IListItem from this INamedList. You have to add WebEditor to specify the ID of the INamedList. Each tab will be IListItem and on PageViewCreated you need to set the content of an item.

    protected void Page_Load(object sender, System.EventArgs e)
       {
           if (!Page.IsPostBack)
           {
               if (ListsIds.Count() != 0)
               {
                   ListManager manager = new ListManager();
                   INamedList getSpecificList = manager.GetList(ListsIds[0]);
                   if (getSpecificList.Items.Count > 0)
                   {
                       foreach (IListItem item in getSpecificList.Items)
                       {
                           contentlist.Add(item);
                           AddTab(item.Headline);
     
                       }
                   }
               }
           }
       }
     
       private void AddTab(string tabName)
       {
           RadTab tab = new RadTab();
           tab.Text = tabName;
           RadTabStrip1.Tabs.Add(tab);
           RadPageView pageView = new RadPageView();
           pageView.ID = tabName;
           RadMultiPage1.PageViews.Add(pageView);
       }
     
       protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
       {
           ListManager manager = new ListManager();  
           Label lb = new Label();
           foreach (IListItem item in contentlist)
           {
               lb.Text = item.Content;
           }
           e.PageView.Controls.Add(lb);
       }
     
     
       [TypeConverter("Telerik.Lists.WebControls.ListsIdsConverter, Telerik.Lists")]
       [WebEditor("Telerik.Lists.WebControls.ListSelector, Telerik.Lists")]
       public Guid[] ListsIds
       {
           get { return this.ids; }
           set { this.ids = value; }
       }
     
       public string ProviderName
       {
           get
           {
               if (String.IsNullOrEmpty(this.providerName))
                   this.providerName = ListManager.DefaultProviderName;
               return this.providerName;
           }
           set
           {
               this.providerName = value;
           }
       }
       private string providerName;
       private Guid[] ids;
       IList<IListItem> contentlist = new List<IListItem>();


    Regards,
    Ivan Dimitrov
    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.
  3. amar koli
    amar koli avatar
    19 posts
    Registered:
    19 Feb 2010
    12 Mar 2010
    Link to this post
    Hi
    I tried this sample, but its gave me following error.

    Compiler Error Message: CS0308: The non-generic type 'System.Collections.IList' cannot be used with type arguments

    Source Error:

    Line 82:     private string providerName;
    Line 83:     private Guid[] ids;
    Line 84:     IList<IListItem> contentlist = new List<IListItem>();
    Line 85: 
    Line 86: }

    in the .cs file i have this declaration at the beginning, or should i add something more.

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using Telerik.Web.UI;
    using Telerik.Lists;
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Mar 2010
    Link to this post
    Hi amar koli,

    You have to use  System.Collections.Generic. You can gather more information at MSDN

    Best wishes,
    Ivan Dimitrov
    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.
  5. amar koli
    amar koli avatar
    19 posts
    Registered:
    19 Feb 2010
    12 Mar 2010
    Link to this post
    Thanks for the fast answer, but that did not help.

    its now giving this error
    Compiler Error Message: CS0246: The type or namespace name 'TypeConverter' could not be found (are you missing a using directive or an assembly reference?)

    Source Error:

    Line 60: 
    Line 61: 
    Line 62:     [TypeConverter("Telerik.Lists.WebControls.ListsIdsConverter, Telerik.Lists")]
    Line 63:     [WebEditor("Telerik.Lists.WebControls.ListSelector, Telerik.Lists")]
    Line 64:     public Guid[] ListsIds

    Please help, i am also new to .net coding.

    also the link provided is not working.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Mar 2010
    Link to this post
    Hello amar koli,

    Here are the references you need

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using Telerik.Lists;
    using System.Collections;
    using System.ComponentModel;
    using Telerik.Cms.Web.UI;

    Adding references is General ASP.NET knowledge. 

    Greetings,
    Ivan Dimitrov
    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.
  7. amar koli
    amar koli avatar
    19 posts
    Registered:
    19 Feb 2010
    12 Mar 2010
    Link to this post
    sorry to trouble you again,

    by adding the reference, the error is not displayed when i add the control, but when i click on the select for selecting the listslds, i get this very long error. what could the reason for this.

    Unable to cast object of type 'ASP.usercontrols_sbi_controls_samplelist_ascx' to type 'Telerik.Lists.IListDisplay'.

    Server Error in '/SBI_MF' Application.

    Unable to cast object of type 'ASP.usercontrols_sbi_controls_samplelist_ascx' to type 'Telerik.Lists.IListDisplay'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of type 'ASP.usercontrols_sbi_controls_samplelist_ascx' to type 'Telerik.Lists.IListDisplay'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidCastException: Unable to cast object of type 'ASP.usercontrols_sbi_controls_samplelist_ascx' to type 'Telerik.Lists.IListDisplay'.]
       Telerik.Lists.WebControls.ListSelector.CreateChildControls() +463
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +50
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
  8. Leonard
    Leonard avatar
    19 posts
    Registered:
    01 Dec 2005
    13 Mar 2010
    Link to this post

    Hi Amar,

    Shameless plug: have a look at Tabbed Content View control available for Sitefinity versions 3.6, 3.7

    Create your products as generic content items instead and making them available in a dynamic tabbed view is as easy as assigning them a tag. Additional products that might be created in the future will be automatically added to the tabbed view as soon as they're assigned the same tag, no need for page design changes.

    I hope this helps,
    Leonard
  9. amar koli
    amar koli avatar
    19 posts
    Registered:
    19 Feb 2010
    15 Mar 2010
    Link to this post
    hi,

    any update on why i am getting the error and how to fix it.
Register for webinar
9 posts, 0 answered