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

Forums / Developing with Sitefinity / modifying panelbar text

modifying panelbar text

4 posts, 0 answered
  1. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    03 May 2010
    Link to this post
    hi
    i wish to modify the panelbar text to look for certain strings and remove them
    i.e.

     

     

    if (node1.Title.Contains("menu1 - "))

     

    { e.Item.Text == node1.title.Substring(0, 7); }

    so basically, look for that string, and remove it from the text of the menu (and leave everything else)

    how would i do this as the above doesn't work
    Ideally, i'd like to do a few of these, and expose them as config settings

    thanks

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 May 2010
    Link to this post
    Hi Dave,

    Try adding the logic below to ItemDataBound event of your RadPanelBar

    public void RadPanelbar1_ItemDataBound(object sender, RadPanelBarEventArgs e)
      {
          CmsSiteMapNode cmsNode = e.Item.DataItem as CmsSiteMapNode;
          if (cmsNode != null)
          {
              var text = e.Item.Text;
              if(text.Contains("Menu"))
              {
                       // make the replacement and set the e.Item.Text
                  e.Item.Text = "SomeOtherText";
              }
          }
     
             .....
     
               // some other code goes here
     }

    You could use appSettings Element (General Settings Schema) to get the config settings.

    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.
  3. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    12 May 2010
    Link to this post
    this worked great thanks

    QUick question, I need to do the same for a tab strip, what sub should i do this on?

    thanks!!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 May 2010
    Link to this post
    Hello Dave,

    The logic is similar for the RadTabstrip , but it depends on how you bind the control. You can access the items on Page_Load as shown below

    RadTabstrip1.DataBind();
     foreach (RadTab t in RadTabstrip1.GetAllTabs())
     {
       // get items here
     }

    You could use RadTabstrip1.Tabs if you want to access only the root level items which will be better for the page performance.

    Sincerely yours,
    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.
Register for webinar
4 posts, 0 answered