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

[Solved] reading combobox object --> NULL

4 Answers 89 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.
Gerard Eikelboom
Top achievements
Rank 1
Gerard Eikelboom asked on 07 Oct 2010, 11:30 AM

I bind my combobox client side. when i click it all the values are in there.

<%

 

= Html.Telerik().ComboBox()

 

.Name(

"SelectedWebshopTaal"

 

 

)

 

.HighlightFirstMatch(

 

true)

 

.Filterable(filtering =>

filtering.FilterMode(

AutoCompleteFilterMode

 

 

.Contains))

 

.DataBinding(binding => binding.Ajax()

.Select(

"_SelectedWebshopTaal"

 

 

, "Account").Cache(true))

 

%>

So i have no problems with that.

When I try to read the object I get an js error, and comboBoxTaal is null
I have done this before on other pages and no problem.
Am I missing something here?

 


var comboBoxTaal = $("#SelectedWebshopTaal").data("tComboBox");

Regards,
Gerard

 

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Oct 2010, 11:33 AM
Hi Gerard Eikelboom,

 This sounds similar to this forum thread. You can check it out.

If the accepted solution does not help - please provide some more details. Ideally you could attach a working project.

Regards,
Atanas Korchev
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
Gerard Eikelboom
Top achievements
Rank 1
answered on 07 Oct 2010, 12:27 PM
Hi Atanas,
Wel i have now this:
<% 
Html.Telerik().ScriptRegistrar().jQuery(false).OnDocumentReady("bindCombobox();")

in my aspx page I have this
<script 
type="text/javascript"><BR>        
$(document).ready(function () 
{<BR>            function 
bindComboBox() 
{<BR>                
var comboBoxTaal = $("#SelectedWebshopTaal").data("tComboBox");

When I run my site. before it's up I get the message (see enclosed.)
And that for every page I click. Because the ScriptRegistrar is in the Masterpage.
Am I correct that it expects on every page the function "bindCombobox()"

So if that's the case ........
0
Atanas Korchev
Telerik team
answered on 07 Oct 2010, 12:36 PM
Hi Gerard Eikelboom,

 You don't need to add the OnDocumentReady in the master page's script registrar. You can add a brand new ScriptRegistrar just after the combobox so that statement is emitted only for that page.

Regards,
Atanas Korchev
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
Gerard Eikelboom
Top achievements
Rank 1
answered on 07 Oct 2010, 12:53 PM
Thanks Atanas,
That did the trick.

Regards,
Gerard
Tags
ComboBox
Asked by
Gerard Eikelboom
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Gerard Eikelboom
Top achievements
Rank 1
Share this question
or