Embedded ListView question

3 posts, 0 answers
  1. Jim
    Jim avatar
    17 posts
    Member since:
    May 2010

    Posted 02 Mar 2012 Link to this post

    I'm working a project where there is a ListView embedded within another ListView. 
    I'm having difficulty performing a databind on the embedded ListView when the user deletes an entry from it.  I receive "Object reference not set to an instance of an object" as an error.  The entry does get deleted but I'm unable to refresh the ListView to reflect the deleted entry.  Thanks very much for any assistance!




    Protected Sub lvMissionSubTasks_ItemDeleting(sender As Object, e As Telerik.Web.UI.RadListViewCommandEventArgs) Handles lvMissionSubTasks.ItemDeleting




    If TypeOf e.ListViewItem Is RadListViewItem Then




    Dim lbl As Label = TryCast(e.ListViewItem.FindControl("lblItemID"), Label)




    Dim de As New LaunchChecklist.BUS.Items












    Dim lv As RadListView = DirectCast(e.ListViewItem.FindControl("lvMissionLevel3SubTasks"), RadListView)





    End If




    End Sub


  2. Jim
    Jim avatar
    17 posts
    Member since:
    May 2010

    Posted 06 Mar 2012 Link to this post

    Any suggestions?
  3. DevCraft R3 2016 release webinar banner
  4. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 07 Mar 2012 Link to this post

    Hello Jim,

    The thrown exception occurs because one of defined variables value is null. The two possibilities are the lbl Label control or the lv RadListView control. In order to resolve your issue you could set up a breakpoint and see where the exception is thrown and from which of the two controls. The next step is to further investigate how to access the control so the FindControl method finds it successfully.

    Kind regards,
    Antonio Stoilkov
    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