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

Object reference not set to an instance of an object popup

17 Answers 457 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Ratzai
Top achievements
Rank 1
Ratzai asked on 17 Oct 2012, 01:38 PM
I have problem with the AutoCompleteBox where i get an Object reference not set to an instance of an object error in popup.

I have the placed the control inside a DetailsView like this

<InsertItemTemplate>
 <telerik:RadComboBox ID="CmbChemicalsInsertMode" CheckBoxes="true" Filter="Contains" HighlightTemplatedItems="true" ExpandDirection="Up" MarkFirstMatch="true" AllowCustomText="true" DataTextField="Name" EmptyMessage="Vælg stoffer" Runat="server">
</telerik:RadComboBox>
 <asp:ImageButton ID="BtnAddChemical" CausesValidation="false" ToolTip="Tilføj valgte" width="15px" height="15px" ImageUrl="~/Images/plus.png" OnClick="BtnAddChemical_Click" runat="server" ></asp:ImageButton>
<telerik:RadTextBox ID="TxtDeclaration" TextMode="MultiLine" Rows="5" Text='<%# DataBinder.Eval(Container, "DataItem.Declaration") %>' Runat="server" Skin="Metro"
              Width="170px" />
               
 <telerik:RadAutoCompleteBox ID="RACBChemicals"  InputType="Token" AllowCustomEntry="true" Skin="Metro" DataTextField="Name" DropDownWidth="400"
    DropDownHeight="250" Runat="server"></telerik:RadAutoCompleteBox>
</InsertItemTemplate>

The detailsview is located inside a RadWindow. As soon as i start typing something in the field, i get the previous mentioned popup error.
As soon as i try to move the AutoCompleteBox outside of the DetailsView, the error stops and the control works fine

17 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 17 Oct 2012, 02:49 PM
Hello Ratzai,

Please set the DataSource, DataTextField and DataValueField properties of the RadAutoCompleteBox.

Regards,
Kalina
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.
0
Ratzai
Top achievements
Rank 1
answered on 17 Oct 2012, 02:52 PM
Hi Kalina,

I have been working all day, but not that much so i forgot to set a datasource :-) The datasource is set in code-behind, and i do not use any datavaluefield
0
Accepted
Bimar
Top achievements
Rank 1
answered on 08 Nov 2012, 09:17 AM
Hi All.
The autocompletetextbox control triggers page load every time you type on the control - even if you wrap the control with an update panel -
So,  you must bind the datasource in the "PAGE_LOAD" method in order to solve this problem

Best Regards

Serkan APUL
0
Ratzai
Top achievements
Rank 1
answered on 09 Nov 2012, 11:23 AM
Thank you very much Serkan!
I wasn't aware that the control triggered a postback after each entry adding. 
Problem fixed :)
0
DuelingCats
Top achievements
Rank 2
answered on 13 Dec 2012, 06:33 PM
Seems like rather odd behavior. Is this a bug?
0
Kalina
Telerik team
answered on 17 Dec 2012, 03:38 PM
Hello DuelingCats,

The message "Object reference not set to an instance of an object popup" is displayed in cases there is no DataSource assigned to the RadAutoCompleteBox.
In our latest internal build we have replaced this message with more a clear message: "DataSource not set"

Regards,
Kalina
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.
0
DuelingCats
Top achievements
Rank 2
answered on 17 Dec 2012, 03:47 PM
Thanks for the reply, but I was talking about the postback on each character entered. I understand that if you had a potentially huge dataset, you would not want to post the entire set to the client in a javascript object. However, if dataset is maybe just a couple of hundred records, I would rather set this datasource once and have the client receive the entire dataset on load. This would eliminate the postback with every keystroke and have the autocompletebox use javascript to filter through the dataset on the client's machine. 

This was the situation I was in and ended up removing the autocompletebox to eliminate postback with every keypress. 
0
Martin
Top achievements
Rank 2
answered on 28 Feb 2013, 11:30 AM
Hi Guys,

The below suggestion does not seem to work for me.
---------------------------
Message from webpage
---------------------------
Object reference not set to an instance of an object.0|
---------------------------
OK  
---------------------------
0
Nencho
Telerik team
answered on 05 Mar 2013, 07:59 AM
Hello Martin,

Could you elaborate a bit more on the faced issue? In addition, could you provide us with the implementation of the RadAutoCompleteBox that you use at your end?

Regards,
Nencho
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.
0
Jim
Top achievements
Rank 1
answered on 08 May 2013, 04:21 PM
I am also interested in the postback on each character entered behavior.  Is this a bug. Can this behavior be modified, a.k.a. stopped
0
Shaw
Top achievements
Rank 1
answered on 11 May 2013, 03:07 AM
I would also like to add my support to the control not doing a postback after each character for future versions. 

I had the same probably originally setting my datasource only once and it is fixed now but I think it would be better if it did not require a post back each time.
0
Nencho
Telerik team
answered on 13 May 2013, 10:12 AM
Hello,

The specified behavior is by design. When certain character is typed in the input of the RadAutoCompleteBox, a callback is initiated, in order to perform a request to the database and extract the data, based on the typed text. I would suggest you to use a WebService, like demonstrated in our online demo. Thus a request to the Web Service would be initiated, instead of the previously mentioned callback.

Kind regards,
Nencho
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.
0
Tim
Top achievements
Rank 1
answered on 30 Jun 2014, 11:39 PM
I have to say, telling people requesting a change that the behavior is by design and won't be changed is not the ideal response.

I too would like to request option to turn off postback for each character typed.  In my case it would be a far more costly operation to generate search suggestions during typing as opposed to loading the entire set once and initially.

Thanks,
Tim
0
Nencho
Telerik team
answered on 03 Jul 2014, 11:20 AM
Hello Tim,

There is a scenario, where you could avoid triggering callback each type when a charter is typed - when the ClientFiltering of the control is enabled. However, please keep in mind that when this property is enabled the entire datasource is initially requested and loaded.

Please refer to the following documentation article, describing in details the behavior when the EnableClientFiltering property of the RadAutoCompleteBox is set to true:

http://www.telerik.com/help/aspnet-ajax/autocompletebox-client-filtering.html

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tim
Top achievements
Rank 1
answered on 03 Jul 2014, 05:44 PM
Aha, well this is interesting.  First, thanks for mentioning that this property is now available.  Second - and this would be my error - I thought I was reading thread about RadSearchBox, not AutoCompleteBox, so applying this property to the latter doesn't work.  Any insights on how to get similar non-each-character-posting-back behavior in RadSearchBox?

My apologies for not noticing this detail previously.

Thanks,
Tim
0
Nencho
Telerik team
answered on 08 Jul 2014, 11:08 AM
Hello Tim,

I would suggest you to use RadClientDataSource in order to populate the RadSearchBox with data. With such binding you could avoid triggering the callbacks each time the user types/deletes characters from the input of the control. Please refer to the following online demo which demonstrates the behavior and the implementation of the aforementioned binding approach.

http://demos.telerik.com/aspnet-ajax/searchbox/examples/client-side-data-binding/defaultcs.aspx

In addition, I have created a public item for a feature request, in order to implement the ClientFiltering with the RadSearchBox, which you could vote for and track here :

http://feedback.telerik.com/Project/108/Feedback/Details/133046-add-clientfiltering-feature-to-the-radsearchbox-control


Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Martin
Top achievements
Rank 2
answered on 25 Aug 2014, 12:47 PM
Hi there

Don't worry I managed to get it working.
Tags
AutoCompleteBox
Asked by
Ratzai
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Ratzai
Top achievements
Rank 1
Bimar
Top achievements
Rank 1
DuelingCats
Top achievements
Rank 2
Martin
Top achievements
Rank 2
Nencho
Telerik team
Jim
Top achievements
Rank 1
Shaw
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or