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

5 posts, 0 answers
  1. Alberto
    Alberto avatar
    11 posts
    Member since:
    Nov 2010

    Posted 14 Mar 2011 Link to this post

    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


  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 17 Mar 2011 Link to this post

    Hello Alberto,

    You could check this demo here.

    Best wishes,
    Dimitar Terziev
    the Telerik team
  3. Michal
    Michal avatar
    1 posts
    Member since:
    Mar 2011

    Posted 25 Mar 2011 Link to this post

    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.
  4. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 31 Mar 2011 Link to this post

    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
  5. saeed
    saeed avatar
    4 posts
    Member since:
    Nov 2007

    Posted 10 Dec 2012 Link to this post

    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>



Back to Top