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

Ajax Binding

3 Answers 143 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Laurent Fabre
Top achievements
Rank 2
Laurent Fabre asked on 27 Aug 2010, 04:02 PM
Hi,

It seems that .825 breaks most of the previous javascript calls (I know it's beta)....I'm trying to upgrade my code but so far I only managed to initiate a rebind using .reload() which works as expected.....but whenever I try to select() or use value() to display the current selected value for the Model this will fail with "cannot read property 'length' of undefined" in telerik.combobox.min.js and will never initiate a rebind whatsoever.

I tried using select() with an index got the same error, select() with a function which supposed to filter the correct item with value got the same error.

Also, the JSON is correctly formatted with Selected: true but the combobox just ignores it. 

At first I thought I had to bind first, hence the .reload(), but it doesn't change a thing.

It's driving me insane.

LF

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 27 Aug 2010, 04:27 PM
Hello Laurent Fabre,

Did combobox use Ajax binding. If this is the case, I suppose that you try to reload component and select item immidiately after that. This will cause the aforementioned issue, because combox is not bound when you try to select item.

Could you please elaborate more on your case in order to provide more specific solution? Some code will be helpful.

As a side note, combobox UI components does not honor Selected property, if you try to re-bind them with Ajax. I am glad to inform you that this issue is fixed and will be included in next official release of the Telerik Components for ASP.NET MVC.

Sincerely yours,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Laurent Fabre
Top achievements
Rank 2
answered on 27 Aug 2010, 04:53 PM
Since I use MVC Templates, I'll substitute 
<%= ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty) %>
by 'CustomerComboBox'

Using .713 this used to work nicely :

var v = $('#CustomerComboBox').attr('value');
$('#CustomerComboBox').data('tComboBox').value(v);

This would initiate a dataBinding and select the correct value.

Using .825, well I have no idea why the previous code doesn't work anymore and how to fix it.

Ok, I understand that the comboBox is not ready yet and my code fall into some kind of race condition. Is there a way to know the dataBinding has succeeded, ClientEvents maybe ? Or maybe could you suggest a better way to accomplish what I'm trying to do.

Thanks in advance,

LF

0
Laurent Fabre
Top achievements
Rank 2
answered on 27 Aug 2010, 05:01 PM
I managed to fix it using OnDataBound only on the first loading. Really looking for that release you mentionned :)

LF
Tags
ComboBox
Asked by
Laurent Fabre
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Laurent Fabre
Top achievements
Rank 2
Share this question
or