 |
|
|
 |
|
 |
Hii Dear,
Really cool n nice task you did. Many thanks for sharing.
Regards,
Navin C.
(Software Engineer)
Mail: navin2k6@gmail.com
|
|
|
|
 |
|
 |
thanks for the code sample. i'd like to use it on my webform which starts by grabbing a bunch of data from a database, and populates a gridview control. while it's out there doing its thing, i'd like to keep the user entertained so they don't get bored. this is all done in c# code behind, which the aspx already inherits, so i can't inherit the LoadingNotifier, too, can i?
so how do i implement your cool notify code to keep the user informed?
thanks in advance
kjward
|
|
|
|
 |
|
 |
Im getting this type of error i dont understand why. I placed everything in the aspx no in code behind. All do i am conecting to a data base and retrieving information. and i have placed the initNotify right after de body. and i get the following error,
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Response is not available in this context.
I also tried to place de sub's call in the codebehind right before i conectect to the de BD (thats where i placed de initNotify()) and after i get the sqldatareader i placed another notify()
but it still throws the same error .. what am i doing wrong pls help :S
The page works like this .. i use a textbox in page1.aspx so that the user put in what he would like to look for .. i do a postbackurl to page2.aspx. In page2.aspx in my page_load i have that if its not a postback then conecto to the database and get the information which i store in a sqldatareader, and this fills my textboxes from page2.aspx....
hope i was clear enough img src="/script/Forums/Images/smiley_confused.gif" align="top" alt="Confused | :confused:" />
-- modified at 13:19 Wednesday 15th August, 2007
|
|
|
|
 |
|
 |
Use the class functions in code file then try to use
|
|
|
|
 |
|
 |
how do i use in code behind?
example, when the user click on the button or when te page is loadinf first time (code behind)?
thanks
|
|
|
|
 |
|
 |
its me again... i just wanted to be more clear so that i may get the right and correct response:
I have found your article and love the idea/concept. The question I have is: does it work in the code behind pages or just inline code? I tried using code.
I have a lot of logic in my pages and don’t want to clutter the aspx pages.
if possible can you please throw some sample lines of how to acheive the same functionality in code-behind?
Thanks in advance
|
|
|
|
 |
|
 |
Hi & congratulations, this is a really nice piece of code. Unfortunately I ran into some problems using this with Master pages and IE (operation is aborted with prompt, page does not show properly). I wanted to integrate the progress bar in some content pages that use a master page which uses a <form> tag inside (and a global <div> for layout reasons). Seems that initNotify() breaks when called within a <form> or a simple <div> tag. Did you came across this problem and do you have any hint? Thx and keep up good work! André
|
|
|
|
 |
|
 |
Yup, i need this on masterpage too Cant figure it out, how to run it on master...
|
|
|
|
 |
|
 |
I've had some success using this within a master page.
I did the following:
1. Make LoadingNotifier inherit from System.Web.UI.MasterPage.
2. Take the "(!IsCallback)" out checks out of LoadingNotifier.
3. Have your master page inherit from LoadingNotifier in the code behind.
4. Add initNotify between the body and form tags in the declarative part of the master page.
5. Add Notify("100", "Done"); between the form and body closing tags of the master page.
That was enough for my basic requirements. I had to perform some extra checks in the JavaScript for null objects and I added the ability to directly call completed().
If you wanted to call Notify within the ContentPlaceHolder and assuming your master page is called Foo.master:
<%
((Foo)Page.Master).Notify("50", "Half way there!");
%>
|
|
|
|
 |
|
 |
Hi, this is exactly what i need for my site!
only i know whit about asp, i do know php.
could somebody translate it for me?
i think its not that much effort, but i just cant do it.
that would be VERY nice:P
thanks
|
|
|
|
 |
|
 |
Hi,
First of all thank you for the article, it is quite usefull for me . Also I've noticed that you used some non-standard CSS attributes like "-moz-opacity: 0.75" and "filter: ...". Can you suggest any internet resource with information on these tags? Especialy for Mozilla/Gecko related _moz_... tags, I was googling quite a lot, but did not find anything usefull. Even mozilla oficial developers site has quite a brief description.
Thanks,
|
|
|
|
 |
|
 |
Hi Pharaon
What kind of description are you looking for?
filter : alpha(opacity=50); //IE
MozOpacity : 0.5; //Mozilla , Netscape
KhtmlOpacity : 0.5; //Safari , Konqueror
opacity : 0.5; //Opera and CSS3 Browsers
Hope this helps!
-- modified at 15:03 Sunday 8th October, 2006
Rebuild all succeeded!
|
|
|
|
 |
|
 |
"To display the loading status during Page_Load or other events which are processed prior to sending the page to the client, you can directly write your status message to the Response object and call the Flush method. When the page is completed at the client, you should clean up your status messages"
Can anyone help or give an example on how to do this? I can't get it to work!
|
|
|
|
 |
|
 |
What is it exactly that you can get it to work?
Rebuild all succeeded!
|
|
|
|
 |
|
 |
Sorry, the above code works fine but I was trying to get the the progress bar to work on page load. You say its possible but I couldn't get it to work.
Basically I have a page that has to loop through folders and grab the file sizes. This loop occurs on the page load and while it is doing this it would be great to have a progress bar shown while the code is getting the file sizes.
Also I have a .net 2.0 wizard that gathers data, the last page of the wizard takes all the input and stores it in a database, contacts the bank and does some other stuff. This is done on the Wizards last page onactivate sub and it would be nice to have a progress bar shown while the code executes.
Just wondering if someone could help me with an example of running your progress bar before the page loads if this is at all possible.
Many thanks
|
|
|
|
 |
|
 |
There are many ways you can do this. In most of the cases it is not really worth it to go all the way to the client just to update some percentages because by the time you get to the client the delay is resolved. What you can do is just showing a message or a picture indicating that you are processing the request. In your case a quick workaround to use LoadingNotifier class is to try refactoring your code out of the Page_Load event and call it in the context of your page after you initialized the progress bar. It may get tricky if you have non- declarative data binding, so make sure everything is synchronized.
Cheers!
Rebuild all succeeded!
|
|
|
|
 |
|
 |
THis is a great job.
Vikram
http://www.vikramlakhotia.com
|
|
|
|
 |
|
 |
Hi!,
Do you have the converted vb.net code?
Thanks
|
|
|
|
 |
|
 |
This is mostly Javascript and CSS. You don't need to convert them in VB.NET. If you are concerned about the LoadingNotifier class, it pretty much translates to VB.NET the way it is. As a matter of fact a very similar piece of code would do the same job in PHP, JSP etc.
Rebuild all succeeded!
|
|
|
|
 |
|
 |
CatMark,
below is the converted class to VB. not that it matters much, but here it is( i called mine loader)
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'@ shahin@themorningoutline.com provided this UNDER GNU GPL
'@ For more inforamtion visit www.themorningoutline.com
' VB Port by David Coty - for instructional use only.
' please refer to the original author, shahin@themorningoutline.com for more details
' this code was NOT ported with any converters. use at your own risk
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class loader ' change this class to whatever name you want
Inherits System.Web.UI.Page
Public Sub InitNotify(ByVal strSplash As String)
' Only do this on the first call to the page
'ADDL NOTE: you can possibly do this with ClientScript.RegisterClientScriptBlock
If (Not IsCallback) And (Not IsPostBack) Then
Response.Write(String.Format("<script type='text/javascript' src='scripts/loadingNotifier.js'></script><script language='javascript' type='text/javascript'>initLoader('{0}');</script>", strSplash))
'update the client
Response.Flush()
End If
End Sub
Public Sub Notify(ByVal strPercent As String, ByVal strMessage As String)
If (Not IsCallback) And (Not IsPostBack) Then
'run the setProgress routine
Response.Write(String.Format("<script language='javascript'
type='text/javascript'>setProgress({0},'{1}'); </script>", strPercent, strMessage))
'update the client
Response.Flush()
End If
End Sub
End Class
---- you use the class the same way in a web project but just inherit loader on the page.
HTH - David
|
|
|
|
 |
|
 |
Very good David. About your comment on using ClientScript object, the RegisterClientScriptBlock and RegisterStartupScript methods will not work with the Notify method because of the position where the scripts are written to the HTML document. Also writing to the Response object is faster than dealing with ClientScript object. ClientScript object is very handy but not here!
Cheers!
Rebuild all succeeded!
|
|
|
|
 |
|
 |
I noticed that when i first tried it - i got the initNotify method to work but the Notify Method was a bust because of the HTML position (i got a "can't modify controls in <%%>" error)
I'm still new to asp.net. i'll figure all this out someday
-David
|
|
|
|
 |
|
 |
Thanks David but how do I inherit the loader from my page source as I already have a statement like this -
<%@ Page language="VB" Autoeventwireup="False" Codepage="MyPage.aspx.vb" Inherits="Performance.MyPage" %>
(Performance is a namespace for the whole web project)
Regards
Dave
|
|
|
|
 |
|
 |
hi dave,
i just saw this comment now ( it's October 07)
well, to call this code from a current aspx page, basically just take the code and copy it into an empty class file( name is something like loaderclass or whatever) and just define it in your project manually:
dim myLoader as new loaderclass
myloader.initNotify("blah")
A little late, but i hope it helps!
david
|
|
|
|
 |