ASP.Net progress on first page load - asp.net

I am working on ASP.Net project and Ajax (UpdatePanels and UpdateProgess)
Everything works fine. When I click on a button in order to refresh a drop down list for example, I see progress image in UpdateProgress control.
But, what I have a problem for the first page loading:
I need to display the page content quickly and then feed all dropdowns from database with a progress image animation.
It is hard to do because the first page loading is slow because everything is done in page load.
Anyone have a solution to this?
Thanks

There really isn't much you can do about first page load, because your code has not yet been compiled to be able to run, and show your progress dialog yet. It's a catch-22.
The best you can do is use a warmup tool to try and keep the app domain loaded.

Related

Enable asp button when page is fully loaded

I have an asp page that when accessed it loads up a large grid view of a bunch of data. This can sometimes take a decent amount of time to load because it is a lot of info. If someone clicks the ImageButton to load up a calendar while the page is still loading it will mess up the page and make the page reload. So I'm wondering how I can get it to wait until the page is fully loaded to enable the button. I can have it disabled at the start but I need a way to detect when the page is fully done loading. My program is using a vb.Net code behind by the way. Any help would be greatly appreciated, thank you so much!

ASP.NET: How can I show a loading image when my page performs stored procedure?

I have a page I'm working on and it works correctly in the sense that I press a button and it executes a stored procedure. The problem is the stored procedure takes awhile to complete, and I want the user to know that there is progress being made and that it's not stuck. So is there a good method to give the user some idea of the progress being made? I was going to just simply display an animated gif, but not sure how to do this. Or if there is a more preferred way to do this I'm all ears. Thanks!
Generally it is a bad idea to have a website command take time, but when you have to Microsoft have an Ajax library which works with ASP.Net - this includes a Progress bar control which can appear when you are doing a long task
The site for the ASP.Net Ajax can be found here; http://www.asp.net/ajax
The Ajax Control Toolkit which includes the progress indicator is here; http://www.asp.net/ajaxlibrary/act.ashx
If you do an AJAX call you can use jQuery to show a loading graphic. See this post How to show loading spinner in jQuery?
Yes, you can definitely use an animated .gif to display to the user while the stored procedure is executing. You'll want to use ASP.NET AJAX to accomplish this, specifically using UpdatePanel and UpdateProgress controls.
View the following URL which guides you on implementing the UpdateProgress control: http://www.asp.net/AJAX/Documentation/Live/mref/T_System_Web_UI_UpdateProgress.aspx
The section on "Specifying the Content of the UpdateProgress Control" talks about using the ProgressTemplate to show an animated image that notifies the user of the progress on the page.
--Tyler

Preserve selected option with back button, using jquery mobile & asp.net & ajax

I thought this would be a trivial feature, but I have lost a fair bit of hair trying to figure it out. I have a jquery mobile web page with a select menu. Users click an item in the drop down list, then later click on a link and navigate to another page. Users then click the back button. The desired result is that the selected item remains selected. Right now, the selection is lost, and it defaults to the first element in the list again.
Things I've tried:
1) Use an asp.net dropdownlist with autopostback. This preserves the selected option, but then I get a page flicker because the entire page is posted back.
2) Wrap above asp.net dropdownlist in an updatepanel. This preserves, doesn't flicker, but it wipes out the jquery mobile styling. Also tried some suggested workarounds with firing a jquery create event, but couldn't get anything working.
3) Write cookies on the select change event in javascript, and read them in the asp page_load event. However, page_load is not called when the back button is clicked, so this had no effect.
4) Tried creating a jquery ajax request to a web page method, but the method must be static and therefore I can't get it to modify the page.
Any other ideas? Is it just me or should this indeed be a problem that's been solved a million times?
As an FYI, I am a newbie at web programming, so please spell it out if you have an answer :) (come from a c++/database background).
Thanks!
Turns out even the date scroller could not survive a back button in some cases. For example if the user navigates to another site, and then uses the back button to come back to my jquery mobile site, all my javascript dom manipulations are lost. The solution is non-trivial. I store everything I need to maintain state of a page using html 5 local storage. On the jqm show page event, I detect if all my global variables have been wiped clean, and if so, reload state from local storage. Works perfectly, but it is quite an implementation task. And of course, if local storage is not supported by underlying browser, it all falls to pieces.

ASP.Net 4.0 , Update Panel.. causing flicker of whole webpage

I have made a web site, a chatting application,... On a webpage independent of Master page, i added a Ajax Update Panel, In the update panel i added a timer , a memo, and a hidden field,..
Its working but causing the whole webpage to flicker, that has made my approach ugly..
Please any programmer help me..
Thanks in advance
Can you post the related code segments? Without that, it is difficult to guess what the problem is.
Page flicker could be:
Page load firing twice in update
Timer firing when not intended
The list goes on...
If you are unable to post the code, I would troubleshoot by removing everything but the core functionality until you can get the flicker to stop then add pieces back in. That is really all I can offer you without the code.

ASP.NET, Showing Loading message while Postback

I have an ASP.NET page which has an asp.net button control in it. When the user clicks on the button, the page will do some calculations and then close itself, but when I click on the button during post back, the page shows a blank screen. I want to show a loading message instead of this. I used javascript to show a div which was hidden intitially and shown when the user clicks the button, but when the post back happens, the screen becomes blank. Any idea how to show the loading messsage in this scenario?
Thanks in advance.
Do you really need to avoid ASP.NET ajax or JQuery?
If so: move the heavy processing into an invisible IFRAME. Action your form to the invisible IFRAME, or use javascript to set the location of the IFRAME.
Your 'loading' javascript will display fine. When the form inside the IFRAME completes it just needs to output some javascript to tell the 'parent' to go to location or refresh.
If you use Ajax to post back to the form asynchronously, you can use the UpdateProgress control. Here is a link to an article explaining how to implement the functionality:
How to make a Gmail-like loading indicator with ASP.NET Ajax
Basically, you can't using just postbacks. The browser draws the screen white while waiting for a response from the server. That message you set to show when the user clicks a button was the correct approach (so good work).
But the browser drew the screen white, thinking "Oh boy I'm about to get a response!" and then waited for longer than you think is appropriate.
The only thing you could try would be, in the response, make the very first thing to stream to the browser some sort of loading message that the browser can display while loading the rest (like the gmail loading screen). But personally, I think you could spend your time doing some other development.
You could try other techniques with AJAX though.

Resources