Professional Web Applications Themes

How to handle personalized events of a class in a web form? - ASP.NET General

Hello, I´m trying to do a progress page that indicates some visual information to the user in a long directory copy process. I have a Class that copys directories from one location to other. The function "CopyDirectory" is started in a new Thread. This class also contains one Event that is raised every directory is copied. On my page I have declared an instance of my class with the "WithEvents" modifier and i have writed an event handler for the class event into the page. Every time the event is raised I change the text property of a textbox in ...

  1. #1

    Default How to handle personalized events of a class in a web form?

    Hello,
    I´m trying to do a progress page that indicates some visual information to
    the user in a long directory copy process. I have a Class that copys
    directories from one location to other. The function "CopyDirectory" is
    started in a new Thread. This class also contains one Event that is raised
    every directory is copied.
    On my page I have declared an instance of my class with the "WithEvents"
    modifier and i have writed an event handler for the class event into the
    page. Every time the event is raised I change the text property of a textbox
    in the page but it not shows because the page not refresh the textbox value.
    I don´t know if it is possible to do this in a Web page. (I think In windows
    forms it may be run).
    Any suggestions will be apreciated.

    Thanks.

    Roberto López


    Roberto López Guest

  2. #2

    Default Re: How to handle personalized events of a class in a web form?

    The problem is that only the page can request a refresh of itself. You
    can't do it from the server side.
    You can have the browser refresh the status by putting an HTML line like
    this in your code:
    <META HTTP-EQUIV="refresh" CONTENT="3">
    That will cause the browser to refresh every 3 seconds (and you can check
    the status of the operation each time and redirect to a "done" page when
    appropriate.)
    Here's more details:
    [url]http://www.fawcette.com/vsm/2002_11/magazine/features/chester/[/url]
    [url]http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=547[/url]

    Another option is that you could call a web service from your client side
    JScript. Use the web service behavior for this. (WebService.htc) This
    technique works with IE only.
    Here's more details:
    [url]http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/overview.asp[/url]

    [url]http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/downloads/samples/internet/behaviors/library/webservice/default.asp[/url]

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Roberto López" <robloptelecable.es> wrote in message
    news:%23tfzJf7VDHA.2568tk2msftngp13.phx.gbl...
    > Hello,
    > I´m trying to do a progress page that indicates some visual information to
    > the user in a long directory copy process. I have a Class that copys
    > directories from one location to other. The function "CopyDirectory" is
    > started in a new Thread. This class also contains one Event that is raised
    > every directory is copied.
    > On my page I have declared an instance of my class with the "WithEvents"
    > modifier and i have writed an event handler for the class event into the
    > page. Every time the event is raised I change the text property of a
    textbox
    > in the page but it not shows because the page not refresh the textbox
    value.
    > I don´t know if it is possible to do this in a Web page. (I think In
    windows
    > forms it may be run).
    > Any suggestions will be apreciated.
    >
    > Thanks.
    >
    > Roberto López
    >
    >

    Steve C. Orr, MCSD Guest

  3. #3

    Default Re: How to handle personalized events of a class in a web form?

    Because of the disconnected stateless nature of a web application I don't
    this approach will work.. Here's what I'm guesing is happening..
    Your page is recieving the events as they are raised by your class declared
    WithEvents but the page is only rendered once after the last event fired
    (synchronous execution, meaning the page is not rendered until all the
    processing is done) so your TextBox has the last directory that was copied
    written to its text property...To verify this set a breakpoint in your event
    handler and see if you are hitting that breakpoint...



    "Roberto López" <robloptelecable.es> wrote in message
    news:#tfzJf7VDHA.2568tk2msftngp13.phx.gbl...
    > Hello,
    > I´m trying to do a progress page that indicates some visual information to
    > the user in a long directory copy process. I have a Class that copys
    > directories from one location to other. The function "CopyDirectory" is
    > started in a new Thread. This class also contains one Event that is raised
    > every directory is copied.
    > On my page I have declared an instance of my class with the "WithEvents"
    > modifier and i have writed an event handler for the class event into the
    > page. Every time the event is raised I change the text property of a
    textbox
    > in the page but it not shows because the page not refresh the textbox
    value.
    > I don´t know if it is possible to do this in a Web page. (I think In
    windows
    > forms it may be run).
    > Any suggestions will be apreciated.
    >
    > Thanks.
    >
    > Roberto López
    >
    >

    alien2_51 Guest

  4. #4

    Default Re: How to handle personalized events of a class in a web form?

    Hi,
    And it´s possible to implement something function like AutoPostBack. Eg. the
    option button control like the dropdownlist control has a property
    "AutoPostBack" that do a page postback when the control changed. How can I
    implement something like this to post bak the page when the clas event is
    raised.



    "Roberto López" <robloptelecable.es> escribió en el mensaje
    news:#tfzJf7VDHA.2568tk2msftngp13.phx.gbl...
    > Hello,
    > I´m trying to do a progress page that indicates some visual information to
    > the user in a long directory copy process. I have a Class that copys
    > directories from one location to other. The function "CopyDirectory" is
    > started in a new Thread. This class also contains one Event that is raised
    > every directory is copied.
    > On my page I have declared an instance of my class with the "WithEvents"
    > modifier and i have writed an event handler for the class event into the
    > page. Every time the event is raised I change the text property of a
    textbox
    > in the page but it not shows because the page not refresh the textbox
    value.
    > I don´t know if it is possible to do this in a Web page. (I think In
    windows
    > forms it may be run).
    > Any suggestions will be apreciated.
    >
    > Thanks.
    >
    > Roberto López
    >
    >

    Roberto López Guest

  5. #5

    Default Re: How to handle personalized events of a class in a web form?

    It´s really good explained,

    Thanks a lot.


    "alien2_51" <dan.billown.o.s.p.a.m.monacocoach.com> escribió en el mensaje
    news:OXxUd6EWDHA.1488TK2MSFTNGP09.phx.gbl...
    > The client has to generate the postback, the client has no knowledge of
    > anything your doing on the server... It has no knowledge of your class
    that
    > is responding to events.. In fact, while your page class is bieng
    processed
    > and is responding to events that are bieng raised the client hasn't even
    > been issued a response yet.. So your still at the server you don't have a
    > page or any controls to autopostback from... If you want to use a progress
    > bar build a windows application... or embed a rich control on your page
    that
    > can run its process on the client.. The type of syncronization required
    for
    > a progress bar is not available in a traditional web application that uses
    > ASP.NET controls...
    >
    > HTH
    >
    >
    > "Roberto López" <rlopezeurosistemas.net> wrote in message
    > news:ucdO8ACWDHA.1580tk2msftngp13.phx.gbl...
    > > Hi,
    > > And it´s possible to implement something function like AutoPostBack. Eg.
    > the
    > > option button control like the dropdownlist control has a property
    > > "AutoPostBack" that do a page postback when the control changed. How can
    I
    > > implement something like this to post bak the page when the clas event
    is
    > > raised.
    > >
    > >
    > >
    > > "Roberto López" <robloptelecable.es> escribió en el mensaje
    > > news:#tfzJf7VDHA.2568tk2msftngp13.phx.gbl...
    > > > Hello,
    > > > I´m trying to do a progress page that indicates some visual
    information
    > to
    > > > the user in a long directory copy process. I have a Class that copys
    > > > directories from one location to other. The function "CopyDirectory"
    is
    > > > started in a new Thread. This class also contains one Event that is
    > raised
    > > > every directory is copied.
    > > > On my page I have declared an instance of my class with the
    "WithEvents"
    > > > modifier and i have writed an event handler for the class event into
    the
    > > > page. Every time the event is raised I change the text property of a
    > > textbox
    > > > in the page but it not shows because the page not refresh the textbox
    > > value.
    > > > I don´t know if it is possible to do this in a Web page. (I think In
    > > windows
    > > > forms it may be run).
    > > > Any suggestions will be apreciated.
    > > >
    > > > Thanks.
    > > >
    > > > Roberto López
    > > >
    > > >
    > >
    > >
    >
    >

    Roberto López Guest

Similar Threads

  1. Inherited Control Does Not Handle All Events
    By Jeff in forum ASP.NET Building Controls
    Replies: 2
    Last Post: December 4th, 10:05 PM
  2. Replies: 1
    Last Post: January 1st, 11:29 AM
  3. Can we handle events for user controls
    By Vannela in forum ASP.NET Building Controls
    Replies: 3
    Last Post: November 11th, 04:06 AM
  4. How to handle Form Error Event in class module?
    By P in forum Microsoft Access
    Replies: 1
    Last Post: July 31st, 05:41 PM
  5. Question: Handle Events From Web User Controls
    By VB Programmer in forum ASP.NET General
    Replies: 0
    Last Post: July 3rd, 11:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139