This is a migrated thread and some comments may be shown as answers.

TransferMode=Copy -> System.NullReferenceException

1 Answer 79 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Tobias Jeckle
Top achievements
Rank 1
Tobias Jeckle asked on 14 Aug 2009, 10:20 AM
I tried your example application with automatic database update you provided in this article: databaseupdate.
It works as long as I set the TransferMode="move". As soon as I try to copy the data with TransferMode="copy", I get a System.NullReferenceException.

[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]  
   Telerik.Web.UI.RadListBoxItem.ExtractValues() +10  
   Telerik.Web.UI.RadListBox.PerformInsert(IList`1 items, Int32 position) +251  
   Telerik.Web.UI.RadListBox.PerformTransfer(RadListBox sourceListBox, RadListBox destinationListBox, IList`1 items) +852  
   Telerik.Web.UI.RadListBox.Transfer(IList`1 itemsToTransfer, RadListBox sourceListBox, RadListBox destinationListBox) +184  
   Telerik.Web.UI.RadListBox.OnTransfer(ListBoxPostBackCommand command, Func`2 callback) +137  
   Telerik.Web.UI.RadListBox.RaisePostBackEvent(String eventArgument) +292  
   Telerik.Web.UI.RadListBox.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10  
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13  
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565  
 

The example code is:

<asp:ScriptManager runat="server" ID="ScriptManager1">  
    </asp:ScriptManager> 
    <div> 
        <telerik:RadListBox   
            runat="server"   
            ID="RadListBox1"   
            AllowTransfer="True" 
            TransferMode="Copy" 
            AllowDelete="false" 
            AutoPostBackOnTransfer="true" 
            AllowAutomaticUpdates="true"   
            TransferToID="RadListBox2"   
            DataSourceID="SqlDataSource1"   
            DataKeyField="ID"   
            DataTextField="Value"   
            DataValueField="ID">  
        </telerik:RadListBox> 
        <telerik:RadListBox ID="RadListBox2" runat="server"   
            AllowAutomaticUpdates="True"   
            DataKeyField="ID" 
            DataSourceID="SqlDataSource2"   
            DataTextField="Value"   
            DataValueField="ID">  
        </telerik:RadListBox> 
          
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
            ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"   
            SelectCommand="SELECT * FROM [Table1]"   
            ConflictDetection="CompareAllValues"   
            DeleteCommand="DELETE FROM [Table1] WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))"   
            InsertCommand="INSERT INTO [Table1] ([Value]) VALUES (@Value)"   
            OldValuesParameterFormatString="original_{0}"   
            ondeleting="SqlDataSource1_Deleting"   
            UpdateCommand="UPDATE [Table1] SET [Value] = @Value WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))">  
            <DeleteParameters> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </DeleteParameters> 
            <UpdateParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </UpdateParameters> 
            <InsertParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
            </InsertParameters> 
        </asp:SqlDataSource> 
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"   
            ConflictDetection="CompareAllValues"   
            ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"   
            DeleteCommand="DELETE FROM [Table2] WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))"   
            InsertCommand="INSERT INTO [Table2] ([Value]) VALUES (@Value)"   
            OldValuesParameterFormatString="original_{0}"   
            SelectCommand="SELECT * FROM [Table2]"   
            UpdateCommand="UPDATE [Table2] SET [Value] = @Value WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))">  
            <DeleteParameters> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </DeleteParameters> 
            <UpdateParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </UpdateParameters> 
            <InsertParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
            </InsertParameters> 
        </asp:SqlDataSource> 

1 Answer, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 17 Aug 2009, 02:35 PM
Hi Tobias Jeckle,

I have managed to reproduce the issue, It seems to be a bug in the RadListBox. I have logged it into our bug tracking system, however it will require some additional research in order to be fixed. We will do our best to fix it for the next week's internal build. Unfortunately I cannot present you with a temporary workaround, because the issue is very specific and is in the very core of the transfer functionality.

I have updated your Telerik points for pointing us to this problem.

Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ListBox
Asked by
Tobias Jeckle
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or