Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3301052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:42:58+00:00 2026-05-17T20:42:58+00:00

I’m using Quartz.NET for a system I am creating, where jobs are run via

  • 0

I’m using Quartz.NET for a system I am creating, where jobs are run via a Windows Service and can be added and editted (inlcuding trigger details) in an ASP.NET page.

I’m having some issues though – I need to be able to modify a triggers details, such as the type of simpletrigger or the cronexpression, and I’ve been told that I need to unschedule the job then reschedule it. Problem is, unscheduling the job then rescheduling is totally removing the trigger from the job for some reason. Here is my code for when the Submit button is clicked on the edit page:

 Trigger[] triggers = sched.GetTriggersOfJob(hdnID.Value, hdnGroupID.Value);

        if (ddlScheduleType.SelectedIndex == 1)
        {
            sched.UnscheduleJob(triggers[0].Name, triggers[0].Group);
            foreach (SimpleTrigger trigger in triggers.OfType<SimpleTrigger>())
            {
                if (ddlInterval.SelectedIndex == 0)
                {
                    trigger.RepeatInterval = TimeSpan.Parse("00:00:01");
                }
                else if (ddlInterval.SelectedIndex == 1)
                {
                    trigger.RepeatInterval = TimeSpan.Parse("00:01:00");
                }
                else if (ddlInterval.SelectedIndex == 2)
                {
                    trigger.RepeatInterval = TimeSpan.Parse("01:00:00");
                }


               sched.RescheduleJob(trigger.Name, trigger.Group, trigger);


            }
        }

        else
        {
            foreach (CronTrigger trigger in triggers.OfType<CronTrigger>())
            {
                trigger.CronExpressionString = txtCron.Text;
                sched.UnscheduleJob(triggers[0].Name, triggers[0].Group);
                sched.RescheduleJob(trigger.Name, trigger.Group, trigger);

            }


        }

        sched.AddJob(jobDetail, true);

Any ideas why this isn’t working? Thanks

NEW:

 if (ddlScheduleType.SelectedIndex == 1)

        {
            foreach (SimpleTrigger trigger in triggers.OfType<SimpleTrigger>())
            {
                Trigger newtrigger = new SimpleTrigger();


                if (ddlInterval.SelectedIndex == 0)
                {
                    newtrigger = TriggerUtils.MakeSecondlyTrigger();
                }
                else if (ddlInterval.SelectedIndex == 1)
                {
                    newtrigger = TriggerUtils.MakeMinutelyTrigger();
                }
                else if (ddlInterval.SelectedIndex == 2)
                {
                    newtrigger = TriggerUtils.MakeHourlyTrigger();
                }

                newtrigger.Name = triggers[0].Name;
                newtrigger.Group = triggers[0].Group;
                newtrigger.JobName = triggers[0].JobName;
                newtrigger.JobGroup = triggers[0].JobGroup;

                sched.RescheduleJob(trigger.Name, trigger.Group, newtrigger);


            }
        }

        else
        {
            foreach (CronTrigger trigger in triggers.OfType<CronTrigger>())
            {
                CronTrigger newtrigger2 = new CronTrigger();
                newtrigger2.Name = trigger.Name;
                newtrigger2.Group = trigger.Group;
                newtrigger2.JobName = trigger.JobName;
                newtrigger2.JobGroup = trigger.JobGroup;

                newtrigger2.CronExpressionString = txtCron.Text;
                sched.RescheduleJob(trigger.Name, trigger.Group, newtrigger2);

            }


        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:42:58+00:00Added an answer on May 17, 2026 at 8:42 pm
    • I doubt UnscheduleJob is necessary. Reschedule should delete the old trigger, so try without it
    • Your else code doesn’t make sense:

          foreach (CronTrigger trigger in triggers.OfType<CronTrigger>())
          {
              trigger.CronExpressionString = txtCron.Text;
              sched.UnscheduleJob(triggers[0].Name, triggers[0].Group);
              sched.RescheduleJob(trigger.Name, trigger.Group, trigger);
          }
      

      Do you mean perhaps

          foreach (CronTrigger trigger in triggers.OfType<CronTrigger>())
          {
              trigger.CronExpressionString = txtCron.Text;
              sched.UnscheduleJob(trigger.Name, trigger.Group); //I would remove this 
              sched.RescheduleJob(trigger.Name, trigger.Group, trigger);
          }
      
    • Lastly, I would try rescheduling with a new trigger rather than with the old one modified

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.