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
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
0
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.
Check your data-preparing code and see if you're trying to access a null object's fields or methods.
0
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
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>
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>