I need to run some javascript code every time on page load, after Telerik Ajax controls are rendered on client. I tried to use this code:
It works fine for the first time (regular page load) but on a partial postback this code doesn't run. I understand why it doesn't work but how can I call this javascript function on partial postbacks?
I tried to use RegisterStartupScript but it doesn't work for me too :(
Thank you in advance!
Sys.Application.add_load(SetFocusToField);
function
SetFocusToField() {
if
(indexToFocus == 0 && controlToFocus) {
controlToFocus.focus();
indexToFocus++;
}
}
I tried to use RegisterStartupScript but it doesn't work for me too :(
string
scriptFocus = @"
ResetIndexOnFocus = 0;
SetFocusToField();
";
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"scriptFocus"
, scriptFocus,
true
);
Thank you in advance!