ASP.NET ScriptManager not setting history points? - asp.net

I have an Ajax enabled website, with some calls to the Script Manager to set history points like so:
if (uxScriptManager.IsInAsyncPostBack)
{
uxScriptManager.AddHistoryPoint("x", taxid.ToString());
}
This works just fine 90% of the time.
However, about 10% of the time, the history points stop being set. This seems to happen when I've clicked around a bit and then start using the back button to go back pretty far (usually 6 or 7 steps in the history).
Has anyone else noticed/seen this behavior? The code I've got that picks up the state information from the history points to rebuild the page seems to work fine.It's just sometimes the script manager seems to forget to set the history point.
EDIT
I've noticed some strange behavior with the script manager - after the third or the fourth click back, is seems to break and the Ajax calls no longer work. The user needs to reload the page in order for the history to start working again. Anyone seen this type of behavior? (I'd think if I wasn't doing it right, it wouldn't work at all...)

Related

How to reload a page in DukeScript

DukeScript is quite clever in the way it handle changes to the Model so that code is hot-swapped at runtime, see for example here.
One thing it doesn't seem to handle at Runtime though is changes to the HTML layout. Given it runs in a WebView, a kind of a browse, it would nice just to be able to reload the page without having to stop and restart the app.
So, I've tried adding a "reload" button, but I can't find an easy way to do that after the initialization:
BrowserBuilder
.newBrowser()
.loadPage("pages/index.html")
.loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
showAndWait() does what it's supposed to do, it doesn't return until the browser is closed. There doesn't seem any way to act on the underlying instance of a WebView and its thread.
Ha ha, simple but effective solution:
Reload
Note: Toni Epple says NetBeans would just detect the change, no reload needed.

ng-animate : conditionally switching "back" transition (BUG?)

Hi everyone,
reading through this google group and the fiddles and blogpost linked from there, I managed to get page transitions working with ng-animate.
Here's my Fiddle
the fiddle is nicely commented, please let me know if anything's unclear
By setting a 'transitionClass' (either .LR or .RL) on the ng-view I was able to trigger different css-transitions for every view change.
Now, what I want to do, is manually applying a "back" transition in case of changing the view one step back, no matter whether that step back is caused by a link within the app or the browser's back button.
To do so, within app.run(), I'm listening for $locationChangeStart, saving the current url slug and then checking against it on the next $locationChangeStart to determine whether we're going back one page. If that's the case, the "back" transition is applied.
This works pretty well, except for...
The entering page (.page-enter, .page-enter-active) is transitioning as expected, while the leaving page (.page-leave, .page-leave-active) seems to be stuck on the previously used transition.
I'd expect, setting a transitionClass 'LR' on the ng-view, that both pages, entering and leaving, use the css transition for '.LR page-enter' and 'LR page-leave'.
What seems to happen instead: If the transitionClass was 'ANY' before, the ng-animate will use '.LR page-enter' for the entering page and '.ANY page-leave' for the leaving page.
Reproducing the 'bug':
App starts on Page 1. Go from 1 to 2. Now go from 2 to 3, this transition is broken. Go from 3 to 1, this transition works as expected. Both transitions are 'RL' (Right To Left), so they should look the same. The only difference being that page 2 enters 'LR' while page 3 enters 'RL'. So, actually, page 1 will use the '.enter-active' transition that was originally set for page 3 when changing from 2 to 3.
Is this the expected behavior?
I'm majorly confuzzled right now, but only working with angular for the last week or so and ng-animate being relatively new feature I might very well be missing something. So before reporting a bug or anything I'd welcome any input on this.
Thanks!
Ok, so based on the comments I'm pretty sure you want the incoming page to also determine exit animations to apply to the outgoing page. So you really need your $locationChange code.
It also looks like the problem you are seeing is that you are setting a class on the parent independently on the incoming page but there is nothing to keep the animations waiting for this class change to occur.
The simplest fix seems to be to make the ng-animate depend on your changing variable to determine the animation class names:
<ng-view ng-animate="transitionClass"></ng-view>
then the CSS selectors just collapse into single classes:
.LR-enter-active {
...
}
(where transitionClass is still being set on the $rootScope in the locationChangeStart:)
$rootScope.$on("$locationChangeStart", function (event, next, current) {
...
http://jsfiddle.net/9XPVX/4/

Why doesn't Firebug's (itemized) time intervals equal the total time in the Net panel/tab timeline?

Below, you'll see a snapshot of Firebug's Net Panel/Tab after I clicked a submit button on a form in an ASP.NET web application, to the time the response came back from a full page postback. (Actually I don't know when Firebug's NET panel timeline stops... I'm guessing it's when the page finally renders... please tell me if you know.)
I'd like to understand what each interval below means (1-10). If each vertical line means something different, then just say "1-2" or "2-3" to indicate the vertical line. I'm noticing that the times from the itemized URL lines in the timeline don't match the total time. Where did this time go? How can I pinpoint the slowness?
My goal is to find out how I can speed up this page. But in the mean time, I'd like to understand what's happening in the page first. I'm a bit concerned about #7 and #10. That's what I'm primarily trying to figure out right now.
FYI: The image is very small in the thread's question, so if you open the image in a new tab (or window) it will be easier to see.
If I haven't provided enough information, please ask.
==================
9/20/2011 update # 12:49am
Removed the iFrame, but that did not help performance.
OK, in the first image you've got persist turned on which means Firebug will show the requests for more the one page i.e. doesn't clear down one reload (http://getfirebug.com/wiki/index.php/Net_Panel).
8 is the DOMContentLoaded event being fired which is the point the browser can start rendering the page
6 is the onload event firing
(Not sure what the other intermediate lines are)
7 & 9 are the UI thread being blocked by the parsing / execution of javascript
Have a read of this Chapter from #souders book on blocking Javascript for an explanation (http://books.google.co.uk/books?id=E7p-07kNfXYC&lpg=PR15&ots=UMcnSGjhOr&dq=javascript%20blocking%20souders&pg=PA27#v=onepage&q=javascript%20blocking%20souders&f=false)

Wrapping AVCam demo from WWDC 2010

I have three camera-based apps (that take still pictures) in the app-store and have got feedback that the UIImagePickerController interface is very slow - and I can't deny that. So, to improve the performance of the app, I started to experiment with the AVCam Demo source code from the WWDC 2010.
Since the AVFoundation framework does not interact with the UI Kit, I have been successful at wrapping a view around the demo. I am able to transition between the view controllers successfully. The only thing that I've modified is replaced the Record button with the Exit button (to exit to the wrapping view controller)
The modified app works fine during the first session (wrapper -> demo) If I exit the demo to the wrapper, and come back to the demo second time , the video frame in the preview layer freezes a second or two after. The app itself does not freeze - just the video is frozen. At this point, all UI buttons are active. But, when I tap "Still" button to capture the image, I get the following error in an alert:
The operation cannot be completed (AVFoundationErrorDomain error - 11800.)
This cannot be duplicated in the original demo code - because you can't close and reopen the session. So, I am wondering if it has anything to do with the way I "exit" from the session in my test. Here's the "exit" action that I added in the demo code:
- (IBAction)exit:(id)sender
{
[[self captureManager] stopRecording];
[self dismissModalViewControllerAnimated:YES];
}
Is this sufficient - or did I miss something?
Regards, Sam.
There's a little problem of cleaning up a capture session in an orderly fashion, as there's some asynchroneous calls with no alerts of when they're done.
Try stopping and releasing as suggested in this question:
How to properly release an AVCaptureSession
(take the solution with most up votes)
If that doesn't help you may need to post some more code here. Are you sure that's all you changed?
Good luck!
Oded.

getting up to date contents of an iFrame

Is it possible to get up to date contents from an iframe? Lemme explain the problem I am encountering:
function modify_iframe(url){
my_iframe.src = url;
iframe_content = my_iframe.contentDocument;
//....code to modify the content goes here,,,,
}
The first time I call modify_iframe(url_a) it sets the source as I would expect but the iframe_content is a blank document.
The second time I run modify_iframe(url_b) it sets the source as I would expect but the iframe_content is actually that of url_a.
So it seems that contentDocument is not returning the contents of the new source, but rather the source before it was changed. Anyone know why that is and if there is a way around it?
Additional background info: We have been adding an event listener to fire off on the iframe load event which occurs when the src is changed. This was giving us the contents when calling contentDocument; however, users were being prompted that our site had unauthenticated content even though we use https for everything including the src. After removing the event listener we no longer receive the unauthenticated content warning, but the contentDocument of our iframe is always one step behind as described above.
Um, first try using a setTimeout to wait for the page content to load. But that's not a nice solution. What browser are you testing on? If it were me I would try to get to the bottom of the "unauthenticated content" error prompt.

Resources