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

disable controls

1 Answer 128 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Piyush Bhatt
Top achievements
Rank 2
Piyush Bhatt asked on 10 Apr 2008, 10:06 PM

I want to disable a combobox when I page loads and then use the Javascript to enable it.

This is the problem
>> If I use the server side disable method to disable the control then post-back does not have its value. So I can't do it from server side.
>> From client side I want to disable it when the page loads but if I call RegisterStartupScript() method to disable the control then it gives error that the control is not found - that may be because control is not loaded yet.
>> RadComboBox does have OnClientLoaded method - that can be used - but then I have so many controls on page and I would like to disable all of them in function rather than setting this property for each control.

I believe easy solution "to call a javascript when all telerik controls are loaded" is available but just I don't know
-Piyush

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 14 Apr 2008, 08:30 AM
Hi Piyush,

Please find attached a sample project illustrating that even that RadComboBox is disabled on server side, its SelectedValue still can be accessed after postback.

Also, the proper time when all controls have been laoded and you can execute your javascript code is the sys.applictaion.load event.
If you want to use this approach, all you have to do is to place your javascript code in the pageLoad() function of the page. For an example:
<script type="text/javascript">  
 
function pageLoad()  
{  
    alert("now all controls are loaded");  
}  
</script> 

You can see the attached project for a reference.

Kind regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Piyush Bhatt
Top achievements
Rank 2
Answers by
Rosi
Telerik team
Share this question
or