Can I trigger a function in asp.net?
-
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"
a function written in a class. Just like this... class test { public void show(){} }
modified on Tuesday, January 15, 2008 3:36:12 AM
-
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> <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!
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"
-
a function written in a class. Just like this... class test { public void show(){} }
modified on Tuesday, January 15, 2008 3:36:12 AM
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"
-
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"
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!
-
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!
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"
-
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"
Ok :) My purpose is to send monthly new letters to every registered members at the end of the month
-
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"
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!
-
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!
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"
-
Ok :) My purpose is to send monthly new letters to every registered members at the end of the month
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"
-
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"
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!
-
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!
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"
-
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"
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!