Selectedindexchanged event of dropdownlistcolumn Error

2 posts, 0 answers
  1. Supriya
    Supriya avatar
    5 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post


    I am working on the selected index change event of the dropdownlist column in insert,delete and update radgridview.. And I get a strange error. I have pasted the code and error below

    Protected Sub gvInsert_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
            If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
                Dim item As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
                Dim editor As GridDropDownListColumnEditor = DirectCast(item.EditManager.GetColumnEditor("UniqueID"), GridDropDownListColumnEditor)

                'handle selected change on server
                editor.ComboBoxControl.AutoPostBack = True
                editor.ComboBoxControl.SelectedIndexChanged += New RadComboBoxSelectedIndexChangedEventHandler(AddressOf list_SelectedIndexChanged)
            End If
        End Sub

        Private Sub list_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

            Dim editedItem As GridEditableItem = TryCast(TryCast(sender, DropDownList).NamingContainer, GridEditableItem)

        End Sub

    Error:Public Event SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

    Can someone please help get thru this error, I have been trying to solve this for the past 2 weeks..
    Any help will be appreciated
  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 01 Oct 2012 Link to this post

    Hello Supriya,

    I guess this error occurs because you declared SelectedIndexChanged event as private. Try to use protected instead of private.
    If that does not fix the error, you could check this link for more information about using RaiseEvent statement.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top