Hi, I have a configuration generated form that can contain controls of types RadTextBox, RadNumericTextBox, RadComboBox and RadDateInput. This form, generated at runtime, can contain 0 to X number of each control. I have a function (below) that I use to get all the controls of those types that match a certain ID naming scheme.
The function executes fine and returns the expected results as long as at least ONE control of each type exists on the page. If, for example, there are no RadDateInputs defined on the page however, I get a "Function Expected" javascript error. Using a javascript debugger I've been able to determine that the error occurs when trying to exeucte the "instanceof" function on the the DateInput type. Unfortunately, instanceof is the check I use to see if there are instance of the RadDateInput control so I can think of no way around this error.
Is there any help you can offer with this issue?
Thanks.
function GetAllControls(filter) |
{ |
var allLookupControls = []; |
var allRadControls = $telerik.radControls; |
for (var i = 0; i < allRadControls.length; i++) |
{ |
var element = allRadControls[i]; |
if (element instanceof Telerik.Web.UI.RadNumericTextBox || element instanceof Telerik.Web.UI.RadTextBox || |
element instanceof Telerik.Web.UI.RadDateInput || element instanceof Telerik.Web.UI.RadComboBox) |
{ |
if(element.get_id().match(filter)) |
{ |
Array.add(allLookupControls, element); |
} |
} |
} |
return allLookupControls; |
} |
The function executes fine and returns the expected results as long as at least ONE control of each type exists on the page. If, for example, there are no RadDateInputs defined on the page however, I get a "Function Expected" javascript error. Using a javascript debugger I've been able to determine that the error occurs when trying to exeucte the "instanceof" function on the the DateInput type. Unfortunately, instanceof is the check I use to see if there are instance of the RadDateInput control so I can think of no way around this error.
Is there any help you can offer with this issue?
Thanks.