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

Client Side Object instance is Null On Load Telerik Combo

3 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abhishek Chowdhury
Top achievements
Rank 1
Abhishek Chowdhury asked on 18 Mar 2010, 03:23 PM
We are using 2008 Q3 version of Telerik controls we are facing this problem.

When we are trying to get the rad combo instance at client side on page load and it is not associated with any event like OnClientSelectedIndexChaged then we are not able to get the instance of the Rad Combo Box.We are using the following code block.
Where cboTerms is the Id of my control.

var cboEntityType = $find("<%= cboTerms.ClientID %>");

var item = cboEntityType.get_selectedItem();

var term = item.get_value();

can you suggest some way out for it, as the above code block is working fine when i use it in Selected Index change on client side.

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 19 Mar 2010, 01:24 PM
Hello Abhishek Chowdhury,

I've tested your code in the pageLoad function with Q3 2008 and everything worked OK. After all an alert appeared to display which item value was selected. Here's the code:

function pageLoad() {
            var cboEntityType = $find("<%= cboTerms.ClientID %>");
            var item = cboEntityType.get_selectedItem();
            var term = item.get_value();
            alert(item.get_value());
        }

You can find the full code in the attached .zip file.

Hope this helps.

Greetings,
Veronica Milcheva
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
Rajasimhan
Top achievements
Rank 1
answered on 06 Jul 2010, 10:34 PM
Hello There,
What if I try to access RadGrid object on the load of page at client side? Coz, I tried and received null object. It works completely fine for Combo (your zip file) but if I add a grid and create a default row on the server side (page load) and try to access the same on the client side (during page load), I receive null object instead of the grid's object which I created at server.

Or please post an example for RadGrid as you did for Combo with the same scenario.

Many thanks,
Raja
0
Peter
Telerik team
answered on 08 Jul 2010, 10:39 AM
Hello Rajasimhan,

Attached is an extended demo with RadGrid as well. It works as expected.

All the best,
Peter
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
Grid
Asked by
Abhishek Chowdhury
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Rajasimhan
Top achievements
Rank 1
Peter
Telerik team
Share this question
or