New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

This partial Class defines RadPanelItem object that inherits NavigationItem, IRadPanelItemContainer and ICloneable.

The RadPanelBar control is made up of items. Items which are immediate children of the panelbar are root items. Items which are children of root items are child items.

A item usually stores data in two properties, the Text property and the Value property. The value of the Text property is displayed in the RadPanelBar control, and the Value property is used to store additional data.

To create panel items, use one of the following methods:

  • Use declarative syntax to define items inline in your page or user control.
  • Use one of the constructors to dynamically create new instances of the RadPanelItem class. These items can then be added to the Items collection of another item or panelbar.
  • Data bind the RadPanelBar control to a data source.

When the user clicks a panel item, the RadPanelBar control can navigate to a linked Web page, post back to the server or select that item. If the NavigateUrl property of a item is set, the RadPanelBar control navigates to the linked page. By default, a linked page is displayed in the same window or frame. To display the linked content in a different window or frame, use the Target property.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class RadPanelItem : NavigationItem, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IMarkableStateManager, IStateManager, INamingContainer, IXmlSerializable, IControlItemContainer, IRadPanelItemContainer, ICloneable

Inheritance: objectControlWebControlControlItemNavigationItemRadPanelItem...

Implements: IAttributeAccessorICloneableIComponentIControlBuilderAccessorIControlDesignerAccessorIControlItemContainerIDataBindingsAccessorIDisposableIExpressionsAccessorIMarkableStateManagerINamingContainerIParserAccessorIRadPanelItemContainerIStateManagerIUrlResolutionServiceIXmlSerializable...

Inherited Members NavigationItem.SetItemContainer(ControlItemContainer)NavigationItem.WriteXml(XmlWriter)NavigationItem.WriteXmlForChildren(XmlWriter)NavigationItem.ReadXml(XmlReader)NavigationItem.ReadXmlForChildren(XmlReader)NavigationItem.LoadChildViewState(object)NavigationItem.SaveChildViewState()NavigationItem.TrackChildViewState()NavigationItem.SetChildrenDirty()NavigationItem.AddedControl(Control, int)NavigationItem.ItemTextIsHTMLEncoded()ControlItem.GetHierarchicalIndex()ControlItem.IsChildControl(Control)ControlItem.GetAllChildren<TControlItem>()ControlItem.GetChildren<TControlItem>(Predicate<TControlItem>)ControlItem.FindChild<TControlItem>(Predicate<TControlItem>)ControlItem.IDControlItem.IndexControlItem.AccessKeyControlItem.TemplateControlItem.ContainerControlItem.RenderingCompatibilityControlItem.ChildrenWebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.LoadViewState(object)WebControl.TrackViewState()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.SaveViewState()WebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.StyleWebControl.EnabledWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SupportsDisabledAttributeWebControl.SkinIDWebControl.TabIndexWebControl.TagNameWebControl.ToolTipWebControl.WidthControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind()Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.OnInit(EventArgs)Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.OnLoad(EventArgs)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.CreateControlCollection()Control.CreateChildControls()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

Initializes a new instance of the RadPanelItem class.

C#
public RadPanelItem()

Use this constructor to create and initialize a new instance of the RadPanelItem class using default values.

Example:
cs-api-definition
RadPanelItem item = new RadPanelItem();
item.Text = "News";
item.NavigateUrl = "~/News.aspx";

RadPanelbar1.Items.Add(item);

Initializes a new instance of the RadPanelItem class with the specified text and URL to navigate to.

C#
public RadPanelItem(string text, string navigateUrl)
Parameters:textstring

The text of the item. The Text property is set to the value of this parameter.

navigateUrlstring

The url which the item will navigate to. The NavigateUrl property is set to the value of this parameter.

Use this constructor to create and initialize a new instance of the RadPanelItem class using the specified text and URL.

Example:
cs-api-definition
RadPanelItem item = new RadPanelItem("News", "~/News.aspx");

RadPanelbar1.Items.Add(item);

Initializes a new instance of the RadPanelItem class with the specified text data.

C#
public RadPanelItem(string text)
Parameters:textstring

The text of the item. The Text property is set to the value of this parameter.

Use this constructor to create and initialize a new instance of the RadPanelItem class using the specified text.

Example:
cs-api-definition
RadPanelItem item = new RadPanelItem("News");

RadPanelbar1.Items.Add(item);

Properties

Gets or sets the Cascading Style Sheet (CSS) class applied to the element enclosing the child items.

C#
public string ChildGroupCssClass { get; set; }
Property Value:

The default value is empry string.

Gets or sets the height of the child item group.

C#
public Unit ChildGroupHeight { get; set; }
Property Value:

A Unit that represents the height of the child item group. The default value is Empty.

If the total child group height exceeds the value specified with the ChildGroupHeight property scrolling will be applied.

Gets or sets the Cascading Style Sheet (CSS) class applied when the panel item is clicked.

C#
public string ClickedCssClass { get; set; }
Property Value:

The CSS class applied when the panel item is clicked. The default value is "clicked".

Example:
C#
By default the visual appearance of clicked panel items is defined in the skin CSS
file. You can use the <strong>ClickedCssClass</strong> property to specify unique
appearance for the panel item when it is clicked.

Gets or sets the content template.

C#
[Bindable(false)]
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(RadPanelItem))]
[TemplateInstance(TemplateInstance.Single)]
public virtual ITemplate ContentTemplate { get; set; }
Property Value:

The content template.

Gets or sets the data item represented by the item.

C#
[Browsable(false)]
public override object DataItem { get; set; }
Property Value:

An object representing the data item to which the Item is bound to. The DataItem property will always return null when accessed outside of ItemDataBound event handler.

Overrides: ControlItem.DataItem

This property is applicable only during data binding. Use it along with the ItemDataBound event to perform additional mapping of fields from the data item to RadPanelItem properties.

Example:
cs-api-definition
private void RadPanelbar1_PanelItemDataBound(object sender, Telerik.WebControls.RadPanelbarEventArgs e)
{
RadPanelItem item = e.Item;
DataRowView dataRow = (DataRowView) e.Item.DataItem;

item.ImageUrl = "image" + dataRow["ID"].ToString() + ".gif";
item.NavigateUrl = dataRow["URL"].ToString();
}

Gets or sets the Cascading Style Sheet (CSS) class applied when the panel item is disabled.

C#
public string DisabledCssClass { get; set; }
Property Value:

The CSS class applied when the panel item is disabled. The default value is "disabled".

By default the visual appearance of disabled panel items is defined in the skin CSS file. You can use the DisabledCssClass property to specify unique appearance for the panel item when it is disabled.

Gets or sets the path to an image to display for the item when it is disabled.

C#
public string DisabledImageUrl { get; set; }
Property Value:

The path to the image to display for the item. The default value is empty string.

Use the DisabledImageUrl property to specify the image for the item when it is disabled. If the DisabledImageUrl property is set to empty string no image will be rendered. Use "~" (tilde) when referring to images within the current ASP.NET application.

Gets or sets a value indicating whether the panel item is expanded.

C#
public bool Expanded { get; set; }
Property Value:

true if the panel item is expanded; otherwise, false. The default is false.

Gets or sets the Cascading Style Sheet (CSS) class applied when the panel item is opened (its child items are visible).

C#
public string ExpandedCssClass { get; set; }
Property Value:

The CSS class applied when the panel item is opened. The default value is "expanded".

By default the visual appearance of opened panel items is defined in the skin CSS file. You can use the ExpandedCssClass property to specify unique appearance for the panel item when it is opened.

Gets or sets the path to an image to display for the item when it is expanded.

C#
public string ExpandedImageUrl { get; set; }
Property Value:

The path to the image to display for the item. The default value is empty string.

Use the ExpandedImageUrl property to specify the image for the item when it is expanded. If the ExpandedImageUrl property is set to empty string no image will be rendered. Use "~" (tilde) when referring to images within the current ASP.NET application.

Gets or sets the Cascading Style Sheet (CSS) class applied when the panel item is focused.

C#
public string FocusedCssClass { get; set; }
Property Value:

The CSS class applied when the panel item is focused. The default value is "focused".

By default the visual appearance of focused panel items is defined in the skin CSS file. You can use the FocusedCssClass property to specify unique appearance for the panel item when it is focused.

Get the Header Template container of the RadPanelItem.

C#
[Browsable(false)]
public RadPanelItemHeaderTemplateContainer Header { get; }

Gets or sets the template for displaying footer in RadcomboBox.

C#
[Bindable(false)]
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(RadPanelItemHeaderTemplateContainer))]
[TemplateInstance(TemplateInstance.Single)]
public virtual ITemplate HeaderTemplate { get; set; }

Gets or sets a value specifying the URL of the image rendered when the node is hovered with the mouse.

C#
public override string HoveredImageUrl { get; set; }

Overrides: NavigationItem.HoveredImageUrl

If the HoveredImageUrl property is not set the ImageUrl property will be used when the node is hovered.

Gets or sets a value indicating the position of the image within the item.

C#
public RadPanelItemImagePosition ImagePosition { get; set; }
Property Value:

One of the Telerik.Web.UI.RadPanelItemImagePosition?text=RadPanelItemImagePosition ++++++++++++++++Enumeration values. The default value is Left.

Gets or sets the path to an image to display for the item.

C#
public override string ImageUrl { get; set; }
Property Value:

The path to the image to display for the item. The default value is empty string.

Overrides: NavigationItem.ImageUrl

Use the ImageUrl property to specify the image for the item. If the ImageUrl property is set to empty string no image will be rendered. Use "~" (tilde) when referring to images within the current ASP.NET application.

Sets or gets whether the item is separator. It also represents a logical state of the item. Might be used in some applications for keyboard navigation to omit processing items that are marked as separators.

C#
public bool IsSeparator { get; set; }

Gets the collection of child items.

C#
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadPanelItemCollection Items { get; }
Property Value:

A RadPanelItemCollection that represents the child items.

Implements: IRadPanelItemContainer.Items

Use this property to retrieve the child items. You can also use it to programmatically add or remove items.

Gets or sets the template for displaying the item.

C#
[TemplateContainer(typeof(RadPanelItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public virtual ITemplate ItemTemplate { get; set; }
Property Value:

A ITemplate implemented object that contains the template for displaying the item. The default value is a null reference (Nothing in Visual Basic), which indicates that this property is not set.

To specify common display for all panel items use the ItemTemplate property of the RadPanelbar class.

Example:
C#
<p>The following template demonstrates how to add a Calendar control in certain
panel item.</p>
<p>ASPX:</p>
<p>&lt;radP:RadPanelbar runat="server" ID="RadPanelbar1"&gt;</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
    <p>&lt;Items&gt;</p>
    <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
        <p>&lt;radP:RadPanelItem Text="Date"&gt;</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
            <p>&lt;Items&gt;</p>
            <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
                <p>&lt;radP:RadPanelItem Text="SelectDate"&gt;</p>
                <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
                    <p>&lt;ItemTemplate&gt;</p>
                    <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
                        <p>&lt;asp:Calendar runat="server" ID="Calendar1"
                        /&gt;</p>
                    </blockquote>
                    <p>&lt;/ItemTemplate&gt;</p>
                </blockquote>
                <p>&lt;/radP:RadPanelItem&gt;</p>
            </blockquote>
            <p>&lt;/Items&gt;</p>
        </blockquote>
        <p>&lt;/radP:RadPanelItem&gt;</p>
    </blockquote>
    <p>&lt;/Items&gt;</p>
</blockquote>
<p>&lt;/radP:RadPanelbar&gt;</p>

Manages the item level of a particular Item instance. This property allows easy implementation/separation of the panel items in levels.

C#
[Browsable(false)]
public int Level { get; }

Gets or sets the URL to link to when the item is clicked.

C#
[Bindable(true)]
public override string NavigateUrl { get; set; }
Property Value:

The URL to link to when the item is clicked. The default value is empty string.

Overrides: NavigationItem.NavigateUrl

Use the NavigateUrl property to specify the URL to link to when the item is clicked. Use "~" (tilde) in front of an URL within the same ASP.NET application. When specifying external URL do not forget the protocol (e.g. "http://").

Example:
C#
The following example demonstrates how to use the <strong>NavigateUrl</strong>
property

<p>
    <p>&lt;telerik:RadPanelBar id="RadPanelBar1"
    runat="server"&gt;<br />
    &lt;Items&gt;<br />
    &lt;telerik:RadPanelItem Text="News" <strong>NavigateUrl="~/News.aspx"</strong>
    /&gt;<br />
    &lt;telerik:RadPanelItem Text="External URL"
    <strong>NavigateUrl="http://www.example.com"</strong> /&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/telerik:RadPanelBar&gt;</p>
</p>

Gets the IRadPanelItemContainer instance which contains the current item.

C#
[Browsable(false)]
public IRadPanelItemContainer Owner { get; }
Property Value:

The object which contains the item. It might be an instance of the RadPanelBar class or the RadPanelItem class depending on the hierarchy level.

Implements: IRadPanelItemContainer.Owner

The value is of the IRadPanelItemContainer type which is implemented by the RadPanelBar class and the RadPanelItem class. Use the Owner property when recursively traversing items in the RadPanelBar control.

Gets the RadPanelBar instance which contains the item.

C#
[Browsable(false)]
public RadPanelBar PanelBar { get; }

Use this property to obtain an instance to the RadPanelBar object containing the item.

Gets or sets a value indicating whether clicking on the item will postback.

C#
public bool PostBack { get; set; }
Property Value:

True if the panel item should postback; otherwise false. By default all the items will postback provided the user has subscribed to the ItemClick event.

If you subscribe to the ItemClick all panel items will postback. To turn off that behavior you should set the PostBack property to false.

Gets or sets a value indicating whether clicking on the item will collapse it.

C#
public bool PreventCollapse { get; set; }
Property Value:

False if the panel item should collapse; otherwise True.

C#
protected override IDictionary<string, string> PropertyMappings { get; }

Overrides: ControlItem.PropertyMappings

C#
protected virtual IRenderer Renderer { get; }

Gets or sets a value indicating whether the item is selected.

C#
public bool Selected { get; set; }
Property Value:

true if the item is selected; otherwise, false. The default is false.

Use the Selected property to determine whether the item is currently selected.

Gets or sets the Cascading Style Sheet (CSS) class applied when the panel item is selected.

C#
public string SelectedCssClass { get; set; }
Property Value:

The CSS class applied when the panel item is selected. The default value is "selected".

By default the visual appearance of selected panel items is defined in the skin CSS file. You can use the SelectedCssClass property to specify unique appearance for the panel item when it is selected.

Gets or sets the path to an image to display for the item when it is selected.

C#
public string SelectedImageUrl { get; set; }
Property Value:

The path to the image to display for the item. The default value is empty string.

Use the SelectedImageUrl property to specify the image for the item when it is disabled. If the SelectedImageUrl property is set to empty string no image will be rendered. Use "~" (tilde) when referring to images within the current ASP.NET application.

C#
protected override HtmlTextWriterTag TagKey { get; }

Overrides: WebControl.TagKey

Gets or sets the target window or frame to display the Web page content linked to when the panel item is clicked.

C#
[TypeConverter(typeof(TargetConverter))]
public override string Target { get; set; }
Property Value:

The target window or frame to load the Web page linked to when the Item is selected. Values must begin with a letter in the range of a through z (case insensitive), except for the following special values, which begin with an underscore:

The default value is empty string.

Overrides: NavigationItem.Target

Use the Target property to specify the frame or window that displays the Web page linked to when the panel item is clicked. The Web page is specified by setting the NavigateUrl property.

If this property is not set, the Web page specified by the NavigateUrl property is loaded in the current window.

Example:
C#
<p>The following example demonstrates how to use the <strong>Target</strong>
property</p>
<p>ASPX:</p>
<p>&lt;telerik:RadPanelBar runat="server" ID="RadPanelBar1"&gt;</p>
<p>&lt;Items&gt;</p>
<p>&lt;telerik:RadPanelItem <strong>Target="_blank"</strong>
NavigateUrl="http://www.google.com" /&gt;</p>
<p>&lt;/Items&gt;</p>
<p>&lt;/telerik:RadPanelBar&gt;</p>

Gets or sets the text caption for the panel item.

C#
public override string Text { get; set; }
Property Value:

The text of the item. The default value is empty string.

Overrides: ControlItem.Text

Use the Text property to specify the text to display for the item.

Example:
C#
This example demonstrates how to set the text of the item using the
<strong>Text</strong> property.

<p>
    <p>&lt;radP:RadPanelbar ID="RadPanelbar1"
    runat="server"&gt;<br />
    &lt;Items&gt;<br />
    &lt;radP:RadPanelItem <strong>Text="News"</strong> /&gt;<br />
    &lt;radP:RadPanelItem <strong>Text="News"</strong> /&gt;<br />
    &lt;/Items&gt;<br />
    &lt;/radP:RadPanelbar&gt;</p>
</p>

Gets or sets the value associated with the panel item.

C#
public override string Value { get; set; }
Property Value:

The value associated with the item. The default value is empty string.

Overrides: ControlItem.Value

Use the Value property to specify or determine the value associated with the item.

Methods

C#
protected override void AddAttributesToRender(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: WebControl.AddAttributesToRender(HtmlTextWriter)

Instantiates the HeaderTemplate inside the Header. Clears all existing controls in the Header before that.

C#
public void ApplyHeaderTemplate()

Clones this instance.

C#
public RadPanelItem Clone()
Returns:

RadPanelItem

C#
protected override ControlItemCollection CreateChildItemCollection()
Returns:

ControlItemCollection

Overrides: ControlItem.CreateChildItemCollection()

C#
protected virtual IRenderer CreateItemRenderer()
Returns:

IRenderer

Expands all parent items so the item is visible.

C#
public void ExpandParentItems()
C#
protected override void LoadFromDictionary(IDictionary<string, object> dictionary)
Parameters:dictionaryIDictionary<string, object>

Overrides: NavigationItem.LoadFromDictionary(IDictionary<string, object>)

C#
protected override void OnPreRender(EventArgs e)
Parameters:eEventArgs

Overrides: Control.OnPreRender(EventArgs)

C#
protected override void RenderContents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: WebControl.RenderContents(HtmlTextWriter)