Hi. I have worked on a problem for a couple of hours now. I want to create dynamic Javascripts which I load into the page when I need. This is a project built on Ajax technique. First I tried to do it by PageMethods but PageMethods can only be static due to viewstate and other things. The problem was that I wasn't able to program against the page object or any other controlbecause the method is static.
My next idea which works is that I have an update panel and within this panel I have a hidden field where I store my scripts. I trigger the hiddenfield to do a postback via javascript. In Page_Init I check if it is an asynchrounos postback and if it is the hiddenfield that caused it. If so I register my new script.
Now to the problem. When this happens I don't want to go further in page lifecycle. I am done. I don't want Page_Load to run and Pre_Render etc.. How can I achieve this? Response.End() stops the process of the page but obviously my scripts are not registered.
Allright I can check in every method if it is an asynchrounos postback and if it is the hiddenfield that caused it but I want to build this into a base page class which all pages will inherit from. I want it to be as generic as possible.
Any ideas? I would appreciate if someone could help me on this. Thanks. /John