I have to enable/disable via javascript all RadComboBoxes from my page, which is inside a master page. I was pointed to this simple tutorial ( http://www.telerik.com/support/kb/aspnet-ajax/general/how-to-create-a-javascript-array-of-all-particular-radcontrols-on-the-page.aspx ), but instead of finding all telerik RadControls in the page, it returns me only the RadControls of the master page. There's something I'm missing to point out that I want the controls of the page inside the master page?
This is what I have now (allRadControls return me the RadSplitter, RadPane ans RadButtons from my master page)
function DisableSave(habilita, botao) {
var btSalvar = $find(botao);
if (btSalvar != null) {
var allRadControls = $telerik.radControls;
if (habilita == "True") {
btSalvar.set_enabled(true);
$("#<%=pnlPrincipal.ClientID%>").find("input,a,textarea,table").attr("disabled", false);
}
else {
btSalvar.set_enabled(false);
$("#<%=pnlPrincipal.ClientID%>").find("input,a,textarea,table").attr("disabled", true);
}
}
RadComboBox exposes an array at client-side that contains all RadComboBox instances. This array can be accessed like:
Telerik.Web.UI.RadComboBox.ComboBoxes
For example:
If RadComboBox controls are embedded in another control, you can simply get these controls from the array described above.
Here is an example of radcombobox nested inside a Grid:
<telerik:RadGrid ID="RadGrid1" runat="server" ...>
...
<EditItemTemplate>
<telerik:RadComboBox ID="RadComboBox1" runat="server"></telerik:RadComboBox>
<telerik:RadComboBox ID="RadComboBox2" runat="server"></telerik:RadComboBox>
<telerik:RadComboBox ID="RadComboBox3" runat="server"></telerik:RadComboBox>
</EditItemTemplate>
... </telerik:RadGrid>
And here is the JavaScript code:
<script>
function pageLoad() {
var combo1 = Telerik.Web.UI.RadComboBox.ComboBoxes[0];
var combo2 = Telerik.Web.UI.RadComboBox.ComboBoxes[1];
var combo3 = Telerik.Web.UI.RadComboBox.ComboBoxes[2];
}
</script>
Here is the help documentation link:
http://www.telerik.com/help/aspnet-ajax/combobox-client-side-basics.html
Hope this helps...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.