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

Object reference not set to an instance of object when I open the dropdown of RadComboBox with EnableAutomaticLoadOnDemand

4 Answers 317 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Alberto
Top achievements
Rank 1
Alberto asked on 14 Mar 2011, 06:17 PM
I'm using the EnableAutomaticLoadOnDemand with a RadComboBox, the EntityDataSource is defined in code behind and connected with the RadComboBox.

When I open the DropDown of the RadComboBox I get this error:

Object reference not set to an instance of object

There is an example of how to define a datasource in the code behind in this case? Is possible using EnableAutomaticLoadOnDemand?

Alberto


4 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 17 Mar 2011, 03:29 PM
Hello Alberto,

You could check this demo here.

Best wishes,
Dimitar Terziev
the Telerik team
0
Michal
Top achievements
Rank 1
answered on 25 Mar 2011, 03:09 PM
I just got that error and it turned out to be the message of an unhandled exception that popped up in the method attached to OnItemsRequested.
Check your data-preparing code and see if you're trying to access a null object's fields or methods.
0
Dimitar Terziev
Telerik team
answered on 31 Mar 2011, 08:53 AM
Hi Michal,

When you use AutomaticLoadOnDemand and you didn't specify the declarative data source on the page, but in code behind, you should add it on every post-back.

All the best,
Dimitar Terziev
the Telerik team
0
saeed
Top achievements
Rank 1
answered on 10 Dec 2012, 07:40 AM
Hi
I`m using nettiers datasource and i gave same error  <Object reference not set to an instance of an object> when I open the radcombobox but when i use sqlDatasource works correctly. please see the code

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<data:BooksDataSource ID="BooksDataSource1" runat="server" SelectMethod=GetAll
  EnablePaging="True" EnableSorting="True" EnableTransaction="True">      
</data:BooksDataSource>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>"
SelectCommand="SELECT * FROM [Books]"></asp:SqlDataSource>

<telerik:RadComboBox ID="RadComboBox1" Runat="server"
DataSourceID="BooksDataSource1" DataTextField="BookName"
DataValueField="BookId" EnableAutomaticLoadOnDemand="True"
EnableEmbeddedSkins="False" EnableVirtualScrolling="True" ItemsPerRequest="10"
Label="Test" ShowMoreResultsBox="True">
</telerik:RadComboBox>

   </asp:Content>



Tags
ComboBox
Asked by
Alberto
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Michal
Top achievements
Rank 1
saeed
Top achievements
Rank 1
Share this question
or