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

Select is not functioning...

1 Answer 85 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tee Bee
Top achievements
Rank 1
Tee Bee asked on 06 Oct 2010, 06:15 PM
code snippet-1 gives me a valid tabstrip on the page, but code snippet-2 gives me null for tabstrip. Pl. let me know,
what could be going wrong?
1. var tabstrip =jQuery('#TabStrip').tTabStrip()  ---> returns valid tabstrip object
2. var tabstrip =$("#TabStrip").data("tTabStrip") --> return 'null' for tabstrip.

Also, the following code, doesn't automatically switch to the 3rd tab:  I'm using jquery.1.4.2 with latest Telerik MVC dll and checked all the JS and css files.

var item = $("li", tabstrip.element)[2];       
tabstrip.select(item);

Thanks,

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Oct 2010, 06:58 AM
Hi Tee Bee,

 The first always works as it initializes a new tabstrip. The second may not work if the client-side component is not yet initialized when you call that code. Client-side objects are initialized in a $(document).ready handler which is output by the ScriptRegistrar. If your code is executed before that moment $("#TabStrip").data("tTabStrip") will return null. You can use the OnDocumentReady event of the ScriptRegistrar to execute code which needs to work with the client-side objects of the UI components or use the OnLoad event of the tabstrip. Here is how to use OnDocumentReady (add this after your tabstrip)

<% Html.Telerik().ScriptRegistrar().OnDocumentReady("myFunction();"); %>
<script>
     function myFunction() {
    
     }
</script>

I hope this helps,

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
Tags
TabStrip
Asked by
Tee Bee
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or