Simple Question - hao can I set enable property from client side?
button2 = document.getElementById("RadButton2_input");
button2.disabled = false;
10 Answers, 1 is accepted
The RadButton control creates a client-side object, as all of our Ajax enabled RadControls do. To get a reference to this object you should use the $find(controlId) method. After you have a reference to the control, you could use its client-side methods, and more specifically you could enable/disable the button itself using the set_enabled(toEnable) method. Your code will look like the following:
the Telerik team
it works fine!
Thank you very much for your quick replies!
My button is nested inside radgrid.
when form load, use
button2 = $find(
will not find the button and will get error
I used view source to get the button id - ctl00_MainContent_ucDataDropOffUCPhase1_RadPanelBar1_i0_rggrid
it gives me error object does not surrport this propery or method.
What control I need to use in order to use
To get the reference to the RadButton's client-side object correctly, you should use the $find(controlId) method, as explained by Pero:
Another option for referencing the RadButtons in a RadGrid is to use their client-side event OnClientLoad in order to retrieve the client-side object of every button and to populate a global array of buttons.
RadButton inside the RadGrid
Global array declaration and OnClientLoad event handler:
the Telerik team
My button is declared as:
In order to change the enabled property I had to use:
The important different being the added ".control" bit. I use <%=rbtnSave.ClientID%> so my JS will work with ASP.Net dynamic IDs correctly.
for example, my RadButton is implemented in part as:
<telerik:RadButton ID="saveAs" AutoPostBack="false" runat="server" OnClientClicked="SaveResults" ...
In my script I have a function that needs to enable/disable the button, so it uses this line of code:
var saveButton = $find("<%= saveAs.ClientID %>");
saveButton.set_enabled(true); // or false
Works for me
When the user click on the save button of the RadGrid and it is not valid it does nothing and when the RadGrid is valid it does save. That all works fine...
I want to alert a message on client side when RadGrid is not valid. How can I check in java-script function when the RadGrid is valid or not for save?
You can try to pass the id of the cell that you want to validate to the UserSaveConfirmation function in the ItemDataBound event, following the approach from this forum post.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Earlier i was facing same issue, here there is a difference with id what we used to find control.
in my case, i am using AutoCompletebox in repeater control, html is rendered with ID = "CBR1_rptCallBackReason_ctl10_ddlRequestLine_Input", but to make it enable/disable following code worked
var cmb =
i need to remove _input from id.
This worked for me (note the SetTimeout to ensure the server event still fires):
<telerik:RadButton runat="server" ID="btnSend" Text="Send" OnClick="btnSend_Click" OnClientClicked="SendClicked" />