Inherit from RadPanelBarEventArgs

3 posts, 0 answers
  1. Richard
    Richard avatar
    11 posts
    Member since:
    Jul 2012

    Posted 23 Jun 2011 Link to this post

    I'm trying to add some extended properties to a RadPanelItem like so:

    Public Class RadPanelItemExtended
    Inherits Telerik.Web.UI.RadPanelItem
    Private _HasChildren As Boolean
    Public Property HasChildren() As Boolean
    Return _HasChildren
    End Get
    Set(ByVal value As Boolean)
    _HasChildren = value
    End Set
    End Property
    End Class

    To access the extended properties on RadPanelBar.ItemClick i need to make the RadPanelBarEventArgs handle RadPanelItemExtended class rather than RadPanelItem class. I thought this was possible through creating an extended eventargs class like so:


    Public Class RadPanelBarEventArgsExtended
    Inherits Telerik.Web.UI.RadPanelBarEventArgs
    Private _RadPanelItemExtended As RadPanelItemExtended
    Public Property RadPanelItemExtended() As RadPanelItemExtended
    Return _RadPanelItemExtended
    End Get
    Set(ByVal value As RadPanelItemExtended)
    _RadPanelItemExtended = value
    End Set
    End Property
    Sub New(ByVal item As RadPanelItemExtended)
    Me._RadPanelItemExtended = item
    End Sub

    When using these extended classes like this:

    Protected Sub RadPanelBar_ItemClick(ByVal sender As Object, ByVal e As RadPanelBarEventArgsExtended) Handles RadPanelBar.ItemClick
    End Sub

    I get the following error:
    Unable to cast object of type 'Telerik.Web.UI.RadPanelBarEventArgs' to type 'RadPanelBarEventArgsExtended'.

    Why is this?


  2. Richard
    Richard avatar
    11 posts
    Member since:
    Jul 2012

    Posted 28 Jun 2011 Link to this post

    Has anyone had time to look into this yet?

    Regards Richard
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Peter avatar
    6637 posts

    Posted 29 Jun 2011 Link to this post

    Hello Richard,

    You might also need to extend the RadPanelBar because of its ItemClick delegate.

    I wonder if you can use a simpler approach - you can easily create a method that checks if an item has children and use it when needed. Are there any specific reasons why you cannot use this method?

    Best wishes,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top