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

Discussion in 'ASP .Net' started by Roberto López, Aug 1, 2003.

  1. 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, Aug 1, 2003
    #1
    1. Advertising

  2. 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:
    http://www.fawcette.com/vsm/2002_11/magazine/features/chester/
    http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=547

    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:
    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/overview.asp

    http://msdn.microsoft.com/downloads...rnet/behaviors/library/webservice/default.asp

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


    "Roberto López" <> wrote in message
    news:%...
    > 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, Aug 1, 2003
    #2
    1. Advertising

  3. Roberto López

    alien2_51 Guest

    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" <> wrote in message
    news:#...
    > 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, Aug 1, 2003
    #3
  4. 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" <> escribió en el mensaje
    news:#...
    > 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, Aug 1, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis E Valencia

    build a personalized link on a datagrid

    Luis E Valencia, May 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    348
    Luis E Valencia
    May 27, 2004
  2. RedHair
    Replies:
    6
    Views:
    595
    RedHair
    Feb 3, 2006
  3. theBlindRef
    Replies:
    1
    Views:
    347
    Konstantinos Pantos
    Nov 21, 2006
  4. Replies:
    6
    Views:
    370
    John W. Kennedy
    Dec 8, 2006
  5. Jeff
    Replies:
    1
    Views:
    270
    Michael Nemtsev [MVP]
    Sep 9, 2008
Loading...

Share This Page