Showing posts with label firing. Show all posts
Showing posts with label firing. Show all posts

Monday, March 26, 2012

UpdatePanel - Wits End - Take Pity

i have an UpdatePanel with mode="Conditional". when a button within the UpdatePanel is clicked it is firing an Atlas partial postback.

i am trying to register a script on each postback. but when the partial postback occurs my script is not getting refreshed. my script is attempting to register itself in Page.PreRender. below is the code in case that it important. please help - im at my wits end with this - thanks

if (!Stopwatch.IsTicking)

script ="var isTicking='F';var hrs=0;var mins=0;var secs=0;";

else

{

TimeSpan timeElapsed =Stopwatch.TimeElapsed;

script ="var isTicking='T';var hrs=" + timeElapsed.Hours.ToString()

+";var mins=" + timeElapsed.Minutes.ToString() +";var secs="

+ timeElapsed.Seconds.ToString() +";";

}

Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),"SWVars", script,true);

Hi,

try to use Page.ClientScript.RegisterStartupScript() instead. Inline scripts in an UpdatePanel are not loaded after a partial postback.


Nope. Hasn't made a difference. Any other suggestions?

Try using Fiddler or Nikhil's Web Dev Helper to do an HTTP trace and see if your script is getting sent down to the client at all.

If it's being sent down, try adding the "debugger;" statement to the top of your script to launch the debugger the moment it's executed (it works in IE, not sure about other browsers).

If it's not being sent down, well, I'll take another look :)

Thanks,

Eilon


When I install Fiddler I get an "unknown error" popup when i click the button within my updatecontrol.

when i uninstall Fiddler this message goes away?


ignore. ive fixed this problem now.

What was your solution to this. I've come across this same problem. Thanks.


i used RegisterClientStartupScript. as it happens the problem was down to my javascript. the javascript ran ok without atlas but i needed to tweak it slightly to run with atlas.

my advice to you is to check your javascript.


If you're using ClientScript.RegisterXxx() and you've simplified your JavaScript down to something that still doesn't work, please share snippets of your code and I'll be glad to take a look.

Thanks,

Eilon


When you have ClientScript.RegisterClientScriptBlock, there is something about the order in which the script is executed, related to Atlas scripts.

As far as I can remember, if you are using an UpdatePanel, your script executes after Atlas scripts.

If you are not using an UpatePanel it executes before.

Wednesday, March 21, 2012

UpdatePanel and Javascript

I seem to be having some trouble with some dynamically generated textboxes' onkeyup firing when they are in an UpdatePanel. Does anyone know of the UpdatePanel having some issues with Javascript?

Any suggestions are welcome. Thanks.

Hi,

could you provide a demo page that reproduces the issue?


It is a little complicated to explain, but:

I have several dynamically created textboxes in UpdatePanel1. I have them the trigger set as a invisible link (basically, a link without any text or target--which simply created the javascript generated postback). Outside of this panel, I have another textbox. The contents of this textbox consists of the sum of all numbers in the UpdatePanel1 textboxes... changing everytime onkeyup fires. Before I implemented the UpdatePanel, the page worked fine. But, since including the textboxes in the UpdatePanel1, the lower textboxes remains empty when I enter data. Basically, I am wanting the same effect.

Does this help?