disable controls

2 posts, 0 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 10 Apr 2008 Link to this post

    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
  2. Rosi
    Rosi avatar
    2529 posts

    Posted 14 Apr 2008 Link to this post

    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");  

    You can see the attached project for a reference.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top