Save and Retrieve from Database

2 posts, 0 answers
  1. Jack
    Jack avatar
    131 posts
    Member since:
    May 2003

    Posted 14 May 2012 Link to this post



    I am saving the transferred items from the RadListBoxDestination Box into one database field like so:-

    Dim _RadListBoxDestinationText As String = Nothing
            For Each item As RadListBoxItem In RadListBoxDestination.Items
                _RadListBoxDestinationText = _RadListBoxDestinationText + item.Value.ToString + vbCrLf

    'Save_RadListBoxDestinationText to the Database

    The data saves OK
    , but then when the user returns I need to repopulate the Destination box and I am trying to do it like so

    Dim _DBString As String = _dr("EOT3CCa")
                Dim _DBSplitString As String() = _DBString.Split(New Char() {vbCrLf})
                Dim _Text As String
                For Each _Text In _DBSplitString
                    Dim item As RadListBoxItem = RadListBoxSource.FindItemByText(_Text)
                    RadListBoxSource.Transfer(item, RadListBoxSource, RadListBoxDestination)

    I get an 'object reference not set..'
    I can output the split string into an ordinary textbox just fine but not the RadListBox - it can't find the items.

    Is there a better way to do this?

    All help most appreciated.


  2. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 17 May 2012 Link to this post

    Hi Jon,

    Could you specify which reference is not set to an instance of an object? It seems to me that the following statement does not return a result:
    Dim item As RadListBoxItem = RadListBoxSource.FindItemByText(_Text)

    Please specify the transferring mode which you are using, is it copy or move?

    All the best,
    Dimitar Terziev
    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