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

Initial JS problem

3 Answers 17 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
GM72
Top achievements
Rank 1
GM72 asked on 03 Apr 2012, 09:10 AM
Hi,

I have a standard razor MVC3 project that I am trying to add Telerik extensions to. I have followed the procedures (you need to make this better, so many people have problems with this) and I am nearly there.

I am just trying to add a simple combobox. The combobox appears and is correctly bound to my data. The problem is that I can't click on it ie it doesn't drop down. I have the same problem with a dropdownlist if I try this. 

I'm guessing this is a javascript problem? Please help!!!!!!!!!!!!!!!!

The combo displays as

<div class="t-widget t-combobox t-header"><div class="t-dropdown-wrap t-state-default"><input class="t-input" id="ComboBox-input" name="ComboBox-input" type="text" value="Item1" /><span class="t-select t-header"><span class="t-icon t-arrow-down">select</span></span></div><input id="ComboBox" name="ComboBox" style="display:none" type="text" value="1" /></div>  

My javascript (@(Html.Telerik().ScriptRegistrar()) added before closing body tag) displays as

<script type="text/javascript" src="/Scripts/2012.1.301/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/Scripts/2012.1.301/telerik.common.min.js"></script>
<script type="text/javascript" src="/Scripts/2012.1.301/telerik.list.min.js"></script>
<script type="text/javascript" src="/Scripts/2012.1.301/telerik.combobox.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#ComboBox').tComboBox({autoFill:false, highlightFirst:false, data:[{"Text":"Item1","Value":"1"},{"Text":"Item2","Value":"2"},{"Text":"Item3","Value":"3"}], index:0});});
//]]>
</script>

Thanks, Graeme

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 03 Apr 2012, 01:14 PM
Hello Graeme,

Your code snippets work correctly on my side. Below is my test page. Have you installed the demo site locally, so that you can see the components in action and compare with your implementation?

Please make sure that Javascript is enabled and you have no Javascript errors.

With regard to the MVC extensions' integration, feel free to share any specific feedback that you may have for improvement. Thank you in advance.


<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<style>
html{font:12px sans-serif;}
</style>
</head>
<body>
<div class="t-widget t-combobox t-header"><div class="t-dropdown-wrap t-state-default"><input class="t-input" id="ComboBox-input"
 
name="ComboBox-input" type="text" value="Item1" /><span class="t-select t-header"><span class="t-icon t-arrow-
 
down">select</span></span></div><input id="ComboBox" name="ComboBox" style="display:none" type="text" value="1" /></div>
 
<script type="text/javascript">
    //<![CDATA[
    jQuery(document).ready(function(){
    jQuery('#ComboBox').tComboBox({autoFill:false, highlightFirst:false, data:[{"Text":"Item1","Value":"1"},{"Text":"Item2","Value":"2"},
 
{"Text":"Item3","Value":"3"}], index:0});});
    //]]>
    </script>
 
</body>
</html>


Greetings,
Dimo
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
GM72
Top achievements
Rank 1
answered on 03 Apr 2012, 03:24 PM
Hi,

The combo was at the start of the master page and didn't seem to work.

I moved into into one of the views and it worked fine. No other changes.

Am I missing something obvious in my understanding as to why this wouldn't have worked?

Thanks
0
Dimo
Telerik team
answered on 03 Apr 2012, 03:43 PM
Hi Graeme,

Possible reasons for such a problem might be invalid HTML markup on the page or a Javascript error. However, I am not able to give any specific advice based on the provided information. If the issue persists, feel free to send a standalone runnable project.

All the best,
Dimo
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
General Discussions
Asked by
GM72
Top achievements
Rank 1
Answers by
Dimo
Telerik team
GM72
Top achievements
Rank 1
Share this question
or