I have an .aspx page that connects to a remote application. I want to add a progress bar to the web page to show the client, the current progress of the operation. There are many text fields in the page and I do want the content to be displayed to the user all the time. (I do not want the page to be refreshed every time the progress bar updates). Is there any way to only update the progress bar without refreshing the whole page, using C# or JavaScript?
p.s. I am kind of new to JavaScript, so some kind of an explanation is greatly appreciated.
(forgive me if the English used is wrong)
Sounds like you need to make use of the AJAX extensions that are enabled in .NET 3.5 by default.
You'll simply put a scriptmanager anywhere on the page, wrap the content that you want to update in an UpdatePanel (which will enable partial page updates) and use an UpdateProgress to feedback the progress to the user.
Have a look here for more.
Related
I'm using asp.net and c#.net.
I'm gonna implement a website that has content navigation like that Microsoft did on this link:
Microsoft Windows
In this link you're able to browse page content with freeze header on postback
and also you're able to browse videos from left Navbar without page postback.
The important thing is for each click url is changed.
Any ideas or help would be appreciated.
Thanks and regards
First off, to clarify, postbacks are only required if you're submitting form elements. If you're creating a webforms application, you can easily use controls like HyperLink with a NavigationUrl to navigate among URLs without needing postbacks.
If what you mean is that you're seeing the page partially updating when following links, that's not what I'm experiencing. The pages appear to completely reload when the links in that page are clicked. In your own site, you can use AJAX and JavaScript to implement a navigation system that doesn't require heavy navigation requests. Look at Manipulating the browser history (MDN) for information on exciting new JavaScript features that will let you modify the browser's URL/history without reloading the page. There are several JS libraries that integrate with this feature to give you "AJAX" navigation capabilities.
To simply get the header to not scroll along with the rest of the page, use position: fixed in the CSS for the element.
I have an ASP.NET form that the user can make lots of changes to, each time they make a change the page PostsBack and the details are updated.
If the user hits the browser back button they go back through all the previous versions of the page.
Is it possible to stop each PostBack being treated by the browser as a new page?
So the would make any changes they like and if they hit the back button it brings them to the previous form and not the same form but a different version?
I know I could use AJAX to update values but I'm not an advanced coder so trying to keep things simple as I haven't used AJAX before.
Ajax is your only solution.
There is no way to remove a page from the browser history. Javascript is explicitly denied the capability.
Now, you could, potentially, stop them from using the back button at all. Although this might result in unhappy users and I'm not 100% certain it works in all browsers.
function body_onload(){
window.history.forward(1);
}
You could use a trick to do it.
On postback you can set a session bit to true saying they submitted that form. On your postback check to see if that value is set. If it is they are trying to do it again and you can just abort it. It wouldn't prevent the postback per se but you could control the logic and prevent it from DOING anything.
I personally would explore ajax as Jquery provides some nice ways to do it and it'd be a learning experience but I suppose this would work as you are asking. On a per session basis. If you only want 1 submission ever use a database to store the activity.
You could use UpdatePanel: http://msdn.microsoft.com/en-us/library/bb386454.aspx
Im using ASPxPopUpControll in which I have ASPxCallBack panel. THis CallbackPanel was embeded there because I wanted to have solution based on callbacks despite of reloading page each time.
In this CallBackPanel I've embeded asp:Wizard control.
What I want to achive is get rid of postbacks after clicking next previous etc buttons in this wizzard.
Any hints?
Maybe there is other way to create nice wizard without any postbacks ?
thanks for help
The ASPxCallbackPanel cannot intercept postbacks and "convert" them to callbacks as the MS UpdatePanel does this. So, a possible solution is to replace the ASPxCallbackPanel with the MS UpdatePanel and use the Wizard inside it. One more solution is to use the ASPxPageControl, position all required controls in its Pages and manage them manually.
I would recommend looking into ajax and jquery for asynchronous postbacks, that way you don't get a page refresh and you would only need to update a smaller part of the ui.
I'm building a few webpages in my webapplication which use a webservice.
While communicating with the webservice, which can take more than a few seconds, I want to display a loading screen. Something like the jquery dialog, where the background is disabled and a loading image appears in the middel of the webpage.
Is this possible and how can I do this?
I use blockUI plugin for such requirement. Its pretty simple and straight forward to use. For example:
$.blockUI({ message: '<h2>Loading</h2>' });
// call to the web service
And in success and failure callbacks of ajax request, include call to unblock
$.unblockUI();
Take a look at the jqModal jQuery plugin - i use this extensively, for example when performing a single-sign-on with Facebook, i show a pretty "Connecting with Facebook" dialog (background is blanked out). very easy to use, and very extensible.
It's basically a hidden div on the page (absolute positioning), which gets shown and centered (and of course other cool effects, such as fading).
So you have full customization of this div - put an image, put an iframe, put a user control.
And it fully supports AJAX - so you can call your WS on load of this modal dialog to load the contents in.
Of course you could roll your own (old school popup, or overlayed image with appropriate z-index), but no point in re-inventing the wheel - especially when there are bucketloads of great solutions available.
Is there a easy way to show some form of progress bar on your form in ASP.NET that the code is busy running in the background (meaning thinking)? Like the default I.E have the small little window on the top that moves when its thinking..........
I have done this before with Ajax but its alot of work and my site is not a Ajax enabled site.
I believe JQuery UI has a progress bar component, might be worth a look.
I've been using the jQuery plugin BlockUI. Pretty easy to set up and very cool looking, especially when used with jgrowl.