Click here to Skip to main content
15,904,494 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my function for sending mail on the poarticular date i have date in
emailsenddate


i want to call emailSend method() for the date
for that i wrote function is it right?
but where i want o use emailsenddate




public void timerTickEvent(DateTime emailsenddate)
  {

      Timer timer = new Timer();
      Label clockLabel = new Label();
      timer.ID = ID + "_tiker";
      clockLabel.ID = ID + "_l";

      UpdatePanel updatePanel = new UpdatePanel();

      Control controlContainer = updatePanel.ContentTemplateContainer;

      controlContainer.Controls.Add(clockLabel);
      controlContainer.Controls.Add(timer);

      updatePanel.Triggers.Add(new AsyncPostBackTrigger()
       {
           ControlID = timer.ID,
           EventName = "Tick"
       });
      updatePanel.ChildrenAsTriggers = true;

      clockLabel.Text = DateTime.Now.ToString();

      timer.Interval = 60000;


      updatePanel.RenderMode = UpdatePanelRenderMode.Block;

      base.Controls.Add(updatePanel);

      emailSend();

  }
Posted
Updated 13-Sep-11 1:53am
v2
Comments
Herman<T>.Instance 13-Sep-11 7:43am    
what is your problem?
why not a timer.Start(); in your code?
suryaswathi 13-Sep-11 8:17am    
hi sir i tried the code ..but i dono exactly the program thatsy posted..
suryaswathi 14-Sep-11 2:19am    
public void timerTickEvent(DateTime emailsenddate)
{
UpdatePanel upanel = new UpdatePanel();


System.Timers.Timer time = new System.Timers.Timer();
string TodayDatetime = DateTime.Now.ToLongTimeString();
time.Start();
time.Interval = 600000;


if (DateTime.Now == emailsenddate)
emailSend();
}

is it correct or want o modify for emaildate has date and emailsend was sendmail on the date ..how i have to change

1 solution

C#
double interval = 0;
if (emailsenddate > dateTime.Now)
{
    TimeSpan span = emailsenddate - dateTime.Now;
    interval = span.TotalMilliseconds;
}
 
Share this answer
 
Comments
suryaswathi 14-Sep-11 2:01am    
here i want o use timer know .in ur code where is timer ..where timer tick event everything?
suryaswathi 14-Sep-11 2:20am    
public void timerTickEvent(DateTime emailsenddate)
{
UpdatePanel upanel = new UpdatePanel();


System.Timers.Timer time = new System.Timers.Timer();
string TodayDatetime = DateTime.Now.ToLongTimeString();
time.Start();
time.Interval = 600000;


if (DateTime.Now == emailsenddate)
emailSend();
}

In that function i want to modify anything for call emailsend on emailsenddate ehich has date

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900