Starr Duskk
asked on
UpdatePanel and Custom Server Control RegisterClientScriptBlock
I have an ajax UpdatePanel. In it there is a combobox on the right, when I click it, it is to update the panel on the left with one of two controls.
When the page initially loads, it loads the first control. When I click, it loads the second control. The second control contains a custom web server control that loads to javascript functions, using: RegisterClientScriptBlock
The page errors when I click to load the second control because the javascript has never been loaded in the page, although when I step through it, it does hit that code with no errors.
If I load the second control first, it does load the script fine.
It appears that loading the second control with ajax doesn't update the javascript as it should.
What are recommendations for getting this javascript loaded on this page. I have thought of putting the javascript for the control in a separate function and calling it on the main page that contains the two controls, however, that seems like a band-aid.
Is there a way to actually load it when the control is loaded that I am missing? Does ajax not support this?
thanks.
When the page initially loads, it loads the first control. When I click, it loads the second control. The second control contains a custom web server control that loads to javascript functions, using: RegisterClientScriptBlock
The page errors when I click to load the second control because the javascript has never been loaded in the page, although when I step through it, it does hit that code with no errors.
If I load the second control first, it does load the script fine.
It appears that loading the second control with ajax doesn't update the javascript as it should.
What are recommendations for getting this javascript loaded on this page. I have thought of putting the javascript for the control in a separate function and calling it on the main page that contains the two controls, however, that seems like a band-aid.
Is there a way to actually load it when the control is loaded that I am missing? Does ajax not support this?
thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry wrong question.
ASKER
It says ScriptManager is not declared.
>>ScriptManager.RegisterCl ientScript Block...
I have a reference and imports:
Imports System.Web.UI
>>ScriptManager.RegisterCl
I have a reference and imports:
Imports System.Web.UI
Do you have reference for System.Web.Extensions.dll?
If you are able to use UpdatePanel then you should be able to use ScriptManager. Both are there in the same assembly and namespace.
If you are able to use UpdatePanel then you should be able to use ScriptManager. Both are there in the same assembly and namespace.
ASKER
I've referenced and done:
Imports System.Web.Extensions
But it errors on the imports line, even though it's in the references.
It says it cannot be found or doesn't contain any public member.
The updatepanel is in my webform in the web site. The stuff I'm trying to register is in a custom server control in a separate project.
Imports System.Web.Extensions
But it errors on the imports line, even though it's in the references.
It says it cannot be found or doesn't contain any public member.
The updatepanel is in my webform in the web site. The stuff I'm trying to register is in a custom server control in a separate project.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just set the interval to the session timeout and on the Tick event redirect to a timeout page.