Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
| Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 16th, 2004, 11:03 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default msg display before starting job

Hi i am working on asp.net

When user press button i am doing long process so before starting process i want to display message like 'Pl wait .....' after finishing the job i want to display 'Processed successfully' something like that.
I am doing like this

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

lbl.Text = "Pl wait"
----
----(my code)
------------

lbl.text="Processed successfully'
end sub

but its always displaying final msg only .Pl advice me how to do it.

thanks

  #2 (permalink)  
Old February 17th, 2004, 08:26 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The label doesn't show up until the page is rendered and the page is never rendered until all your code is done processing.

What you need to do is have an intermediate view of the page that the user sees after they press the button to begin processing.

- Create another button on the form (cmdProcess)
- Use the CSS style display:none; to make cmdProcess invisible. You cannot use the .net visible property because this will cause the button to not render to the HTML. The button HTML must be in the page's HTML, but you just don't want the user to SEE it.
- Use the RegisterStartupScript() method to write out a little javascript that call's that hidden button's click() method.
- Call the startup script from the button handler the user actually clicks.
- Move the code that takes a long time to process to the new button's click handler.

<asp:button runat="server" id="cmdProcess" style="display:none;" />

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim sStartProcess As String
    lbl.Text = "Pl wait"
    sStartProcess = String.Format("<script language=""JavaScript"">document.getElementById("" {0}"").click();</script>", cmdLaunch.ClientID)
    RegisterStartupScript("process",sStartProcess)
End Sub

Private Sub cmdLaunch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLaunch.Click
    'Here's the code that takes a long time to process
    lbl.text="Processed successfully'
Enb Sub


Peter
------------------------------------------------------
Work smarter, not harder.
  #3 (permalink)  
Old February 18th, 2004, 12:02 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi planoie

Thanks for your response.I tried its working fine.But while processing the long task its shoing blank screen instead of 'Pl wait message' my code is here.pl help me.

'aspx page code
 <asp:button runat="server" id="cmdProcess" style="display:none;" />

'.vb file code

'this is actually user clicked button
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sStartProcess As String
        lbl.Text = "Pl wait"
        sStartProcess = String.Format("<script language=""JavaScript"">document.getElementById("" {0}"").click();</script>", cmdProcess.ClientID)
        RegisterStartupScript("process", sStartProcess)
    End Sub

'processed button
Private Sub cmdProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProcess.Click

my long code


end sub

  #4 (permalink)  
Old February 18th, 2004, 12:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm not sure what the tell you. The browser should show anything on the page. Maybe it's just happening too fast. If you can, try looking at the source HTML while the long code is running just to see if the label is there. Also, comment out the Register... line to you can just confirm that the label and hidden button are in the source HTML.

Peter
------------------------------------------------------
Work smarter, not harder.
  #5 (permalink)  
Old February 18th, 2004, 09:38 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for response.

Actually my process is taking 30 sec and its displaying blank screen.When i saw view source of processing screen i can see the label and message also in view source.

<span id="lbl" style="font-weight:bold;"> Please wait Process will take few minutes to complete</span>

When i comment
RegisterStartupScript("process", sStartProcess)
line its showing
'Please wait Process will take few minutes to complete'
but not doing the process.Your given example you are using lunch button also(using total 3 buttons) but i am using 2 buttons only one is user click one other is hidden one.
Can you pl see my below code and suggest me if anything wrong. thanks.

aspx code:

<tr><td>&nbsp;<asp:label id="lbl" runat="server" Font-Bold="True" </asp:label></td></tr>
<asp:button runat="server" id="cmdProcess" style="display:none;" />

.vb code

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sStartProcess As String
        lbl.Text = " Expenses are being allocated. Please wait Process will take few minutes to complete"
        sStartProcess = String.Format("<script language=""JavaScript"">document.getElementById("" {0}"").click();</script>", cmdProcess.ClientID)
        RegisterStartupScript("process", sStartProcess)

    End Sub

Private Sub cmdProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProcess.Click

my long code

end sub



  #6 (permalink)  
Old March 9th, 2004, 10:16 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for response.

Actually my process is taking 30 sec and its displaying blank screen.When i saw view source of processing screen i can see the label and message also in view source.

<span id="lbl" style="font-weight:bold;"> Please wait Process will take few minutes to complete</span>

When i comment
RegisterStartupScript("process", sStartProcess)
line its showing
'Please wait Process will take few minutes to complete'
but not doing the process.Your given example you are using lunch button also(using total 3 buttons) but i am using 2 buttons only one is user click one other is hidden one.
Can you pl see my below code and suggest me if anything wrong. thanks.

aspx code:

<tr><td>&nbsp;<asp:label id="lbl" runat="server" Font-Bold="True" </asp:label></td></tr>
<asp:button runat="server" id="cmdProcess" style="display:none;" />

.vb code

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sStartProcess As String
        lbl.Text = " Expenses are being allocated. Please wait Process will take few minutes to complete"
        sStartProcess = String.Format("<script language=""JavaScript"">document.getElementById("" {0}"").click();</script>", cmdProcess.ClientID)
        RegisterStartupScript("process", sStartProcess)

    End Sub

Private Sub cmdProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProcess.Click

my long code

end sub


  #7 (permalink)  
Old March 10th, 2004, 05:37 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

So you can see the label in the source of the page when you view source while it's processing, but it doesn't show in the browser? I wonder if the browser isn't drawing out the whole page of it's not rendering it even though all the HTML is there, it's odd that it would do that.

Peter
------------------------------------------------------
Work smarter, not harder.
  #8 (permalink)  
Old March 14th, 2004, 09:26 PM
Registered User
 
Join Date: Mar 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://msdn.microsoft.com/asp.net/us...ce07222003.asp

http://www.busyphoto.com
http://mobile.busyphoto.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
error msg almotions ASP.NET 2.0 Basics 3 February 12th, 2008 08:34 AM
how to display error msg in custom ctrl anirosek ASP.NET 1.0 and 1.1 Basics 1 July 25th, 2007 09:34 AM
error msg aspsuraj BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 November 27th, 2006 08:30 PM
Display only names starting with particular letter cookout XSLT 1 June 27th, 2006 11:23 AM
Display a msg when waiting 4 output from database Sach Classic ASP Basics 2 April 29th, 2004 08:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.