run method once

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • huzz

    #1

    run method once

    I have a class method that i like to run once in a page.. so when the page is
    reloaded i don't want to method to run again.

    how is this possible in C#?

    Many Thanks
  • Patrice

    #2
    Re: run method once

    My first thought would be to check IsPostBack...

    It's always best also to describe what you want to do... (for example does
    "reloaded" includes having the same page loaded by someone else or by the
    same person later ? Also if you tell us you are working with the cache etc
    one could suggest to do that based on the presence/absence of this entry in
    the cache etc...)

    Patrice

    --

    "huzz" <huzz@discussio ns.microsoft.co m> a écrit dans le message de
    news:5393377B-E0E0-485A-AF6D-B47C37B7591F@mi crosoft.com...[color=blue]
    > I have a class method that i like to run once in a page.. so when the page[/color]
    is[color=blue]
    > reloaded i don't want to method to run again.
    >
    > how is this possible in C#?
    >
    > Many Thanks[/color]


    Comment

    • huzz

      #3
      Re: run method once

      Patrice thanks for your answer.. i have method which check if files exist in
      a folder.. i just need to do the checking once thats all.

      "Patrice" wrote:
      [color=blue]
      > My first thought would be to check IsPostBack...
      >
      > It's always best also to describe what you want to do... (for example does
      > "reloaded" includes having the same page loaded by someone else or by the
      > same person later ? Also if you tell us you are working with the cache etc
      > one could suggest to do that based on the presence/absence of this entry in
      > the cache etc...)
      >
      > Patrice
      >
      > --
      >
      > "huzz" <huzz@discussio ns.microsoft.co m> a écrit dans le message de
      > news:5393377B-E0E0-485A-AF6D-B47C37B7591F@mi crosoft.com...[color=green]
      > > I have a class method that i like to run once in a page.. so when the page[/color]
      > is[color=green]
      > > reloaded i don't want to method to run again.
      > >
      > > how is this possible in C#?
      > >
      > > Many Thanks[/color]
      >
      >
      >[/color]

      Comment

      Working...