I am using user controls (.ascx) that each generate their own specific client validation functions using names like 'validate<%= NameTextBox.ClientID %>'. I would like to then call these validation functions from a higher level javascript function such as...
function checkControl(controlID) {
//call validate function generated above using controlID
// instead of <%= NameTextBox.ClientID %>
}
I'd guess the syntax to call a concatenated function name is straight forward but I can't seem to find the answer. Any help would be greatly appreciated.
Thanks, Matt
1 Answer 1
You could do this:
function checkControl(controlID){
// create a concatenated function name
var myfuncname = controlid + '_somethingelse';
// invoke the function
window[myfuncname]();
}
answered Dec 16, 2011 at 20:05
Gabe
50.7k29 gold badges147 silver badges182 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js