Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can I trigger a function in asp.net?

Can I trigger a function in asp.net?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasequestion
26 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Abhijit Jana

    Can you tell me what kind of function is this or what is the object of this function ? is it database related ???

    Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

    H Offline
    H Offline
    hogan john
    wrote on last edited by
    #15

    a function written in a class. Just like this... class test { public void show(){} }

    modified on Tuesday, January 15, 2008 3:36:12 AM

    A 1 Reply Last reply
    0
    • P Pankaj Garg

      i was using the timer control in website just for the practise purposes.I saw , the timer control is auto executing after it's time interval if it is a ajax enabled website. If it is a asp.net web site(partially enabled ajax website , i mean , in the asp.net website , i am dragging the ajax controls) then the timer control is not working , it works if in the form load i write protected void Page_Load(object sender, EventArgs e) { Timer1_Tick(sender, e); } the source file code <form id="form1" runat="server"> <div> &nbsp;<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"> </asp:Timer> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> </asp:UpdatePanel> </form>I am unable to understand where i am wrong ?

      If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #16

      Pankaj Garg wrote:

      protected void Page_Load(object sender, EventArgs e) { Timer1_Tick(sender, e); }

      This is not the way delegate a fuction !!!! Check this one :) protected void Page_Load(object sender, EventArgs e) { Timer1.Tick += new EventHandler<EventArgs>(Timer1_Tick); } void Timer1_Tick(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToLongTimeString(); } ;)

      Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

      P 1 Reply Last reply
      0
      • H hogan john

        a function written in a class. Just like this... class test { public void show(){} }

        modified on Tuesday, January 15, 2008 3:36:12 AM

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #17

        hogan.john wrote:

        a function written in a class. Just like this... class test { public void show(){} }

        This is normal function !!! but i want to know why you want to execute it after 30 day . It should be special reason , then we can think a differnt apporch as per requirment :)

        Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

        H 1 Reply Last reply
        0
        • A Abhijit Jana

          Pankaj Garg wrote:

          protected void Page_Load(object sender, EventArgs e) { Timer1_Tick(sender, e); }

          This is not the way delegate a fuction !!!! Check this one :) protected void Page_Load(object sender, EventArgs e) { Timer1.Tick += new EventHandler<EventArgs>(Timer1_Tick); } void Timer1_Tick(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToLongTimeString(); } ;)

          Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

          P Offline
          P Offline
          Pankaj Garg
          wrote on last edited by
          #18

          protected void Page_Load(object sender, EventArgs e) { Timer1.Tick += new EventHandler<EventArgs>(Timer1_Tick); Timer1.Enabled = true; } protected void Timer1_Tick(object sender, EventArgs e) { i += 0; Label1.Text = i.ToString(); } I think after writing the code , the control should auto execute the timer_tick function. But the control is not comming there. the time interval is 1000.

          If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

          A 1 Reply Last reply
          0
          • P Pankaj Garg

            protected void Page_Load(object sender, EventArgs e) { Timer1.Tick += new EventHandler<EventArgs>(Timer1_Tick); Timer1.Enabled = true; } protected void Timer1_Tick(object sender, EventArgs e) { i += 0; Label1.Text = i.ToString(); } I think after writing the code , the control should auto execute the timer_tick function. But the control is not comming there. the time interval is 1000.

            If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #19

            what out comes are you getting in label ??? i think only 0 .

            Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

            P 1 Reply Last reply
            0
            • A Abhijit Jana

              hogan.john wrote:

              a function written in a class. Just like this... class test { public void show(){} }

              This is normal function !!! but i want to know why you want to execute it after 30 day . It should be special reason , then we can think a differnt apporch as per requirment :)

              Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

              H Offline
              H Offline
              hogan john
              wrote on last edited by
              #20

              Ok :) My purpose is to send monthly new letters to every registered members at the end of the month

              A 1 Reply Last reply
              0
              • A Abhijit Jana

                what out comes are you getting in label ??? i think only 0 .

                Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                P Offline
                P Offline
                Pankaj Garg
                wrote on last edited by
                #21

                Label text was Label initially at runtime it is Label after form load.

                If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

                A 1 Reply Last reply
                0
                • P Pankaj Garg

                  Label text was Label initially at runtime it is Label after form load.

                  If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

                  A Offline
                  A Offline
                  Abhijit Jana
                  wrote on last edited by
                  #22

                  you are using ajaexenabled websites na !!!! use ajax enabled sites. and dont initilize local variable inside the Timer_Tick(), because it will remain same :) let me know if any problems

                  Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                  P 1 Reply Last reply
                  0
                  • H hogan john

                    Ok :) My purpose is to send monthly new letters to every registered members at the end of the month

                    A Offline
                    A Offline
                    Abhijit Jana
                    wrote on last edited by
                    #23

                    Hope this helps you ASP.NET Code at Scheduled Intervals [^]

                    Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                    1 Reply Last reply
                    0
                    • A Abhijit Jana

                      you are using ajaexenabled websites na !!!! use ajax enabled sites. and dont initilize local variable inside the Timer_Tick(), because it will remain same :) let me know if any problems

                      Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                      P Offline
                      P Offline
                      Pankaj Garg
                      wrote on last edited by
                      #24

                      i am not using the ajax enables website , it is a asp.net site , there i am using the timer control. Is it mandatory to use the ajax enabled website , in order to use the timer control?

                      If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

                      A 1 Reply Last reply
                      0
                      • P Pankaj Garg

                        i am not using the ajax enables website , it is a asp.net site , there i am using the timer control. Is it mandatory to use the ajax enabled website , in order to use the timer control?

                        If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

                        A Offline
                        A Offline
                        Abhijit Jana
                        wrote on last edited by
                        #25

                        Hope this link will help you :) http://www.velocityreviews.com/forums/t241140-using-timer-with-aspnet-web-application.html[^]

                        Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                        P 1 Reply Last reply
                        0
                        • A Abhijit Jana

                          Hope this link will help you :) http://www.velocityreviews.com/forums/t241140-using-timer-with-aspnet-web-application.html[^]

                          Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

                          P Offline
                          P Offline
                          Pankaj Garg
                          wrote on last edited by
                          #26

                          Do u Know something regarding this Problem

                          If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups