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

ComBoBox and DataList AJAX PostBack

5 Answers 141 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 01 Aug 2008, 01:25 PM
Hi,

I'm using a ComboBox that when the TextChanged event is fired, it updates a datalist on the page. Works fine, when I hit the enter key, it fires the event. Then, if I click out of the combobox somewhere else on the page (because only hitting the enter key in the combobox maintains the focus), the event is fired again. You can see the DataList updates two times. I've tried to cancel a second postback using the combobox's onclientblur, however there doesn't seem to be a way to cancel postbacks through that function. If I click in the combo box and then click out again, without changing text, however -- the ajax update happens yet again and refreshes the datalist.

The weird thing is that the text_changed event still only gets fired once (when I actually changed the text) -- which is proper functionality. I'm not sure what server-wide event is getting fired when I click off of the combobox, but if I disable autopostbacks for the combobox, it doesn't do it anymore (but then of course I can't use the enter key to postback the page)...

For reference, this is the code I'm using:

<telerik:RadComboBox ID="RadComboBox1" Skin="Vista" Width="265" EmptyMessage="Search for your favorite game!" AllowCustomText="true"
                OpenDropDownOnLoad="false" ShowDropDownOnTextboxClick="false" ShowWhileLoading="false" ShowMoreResultsBox="false" ShowToggleImage="false"
                ExpandAnimation-Type="None" AutoPostBack="true" runat="server" />

And the DataList:

                <asp:DataList ID="DataList_Content" runat="server">
                    <ItemTemplate>
                       Content...
                    </ItemTemplate>
                </asp:DataList>

I have the AjaxManager on the page making sure the ComboBox can update the DataList, and there's also the default loading panel on the page.

Any help would be appreciated.

5 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 01 Aug 2008, 01:42 PM
I confirmed that the only server-side events getting fired when I click off of the combobox is Init, Load, PreRender, and Unload. Nothing else...
0
Simon
Telerik team
answered on 04 Aug 2008, 01:09 PM
Hi Jed Horovitz,

I tried to reproduce the problem but to no avail - the TextChanged event fired only once.

Please examine the attached page and compare it to yours. Can you find any differences in the approaches? Can you modify my version so that the problem starts to occur and post the modifications here?

Best wishes,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bob
Top achievements
Rank 1
answered on 06 Aug 2008, 02:07 PM
Found the problem while using your example. Yours didn't have the LoadingPanel. If you simply drag in a default ajax loading panel and set the defaultpanelid in the ajaxmanager to that of the ajax loading panel, you'll have the issue where when you click off of the combobox it does a quick 'refresh' of some sort.
0
Bob
Top achievements
Rank 1
answered on 06 Aug 2008, 02:12 PM
Sorry, I take that back. I just didn't see the refresh anymore when I removed the loading panel. It's still doing some sort of refresh. You may not usually be able to tell this is happening, unless you have links on your page somewhere.

http://www.allgamepreviews.com/ is the project I'm working on -- if you type something into the search and hit enter, you'll get results (depending on what you type, try "test" as an example)... and then immediately click on any of the links of the results. You'll find you have to click it twice in order for it to load the preview of that particular result. The first time you click it you see the loading panel come up and the whole datalist "refreshes", but does not postback.
0
Simon
Telerik team
answered on 07 Aug 2008, 01:26 PM
Hi Jed Horovitz,

I was able to observe the issue on the live url, but could not reproduce it on my side, using the code provided in your first post. It is very likely that the cause of the problem lies somewhere else on the page and is not in the declaration of the RadComboBox.

Could you open a support ticket and send us a simple project where the issue can be reproduced as in the live site? We will investigate the issue right away and hopefully will provide a solution or a workaround.

Kind regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Bob
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Simon
Telerik team
Share this question
or