Reputation: 27
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
Upvotes: 0
Views: 614
Reputation: 50533
You could do this:
function checkControl(controlID){
// create a concatenated function name
var myfuncname = controlid + '_somethingelse';
// invoke the function
window[myfuncname]();
}
Upvotes: 1