mardi 4 août 2015

how to stop save button function running when certain tab is open

I have a page that displays a few different tabs.

<li id="liHeader"><a href="#tabHeader" title="Header">General</a></li>
<li id="liFooter"><a href="#tabNotesComments" id="tabNotes" title="Notes/History of Job">Notes (<%= NoOfNotes %>)</a></li>
<li runat="server" id="liDelivery" ><a href="#<%= tabDeliveryDbrief.ClientID %>" title="Delivery Dbrief">Delivery Dbrief</a></li>

Each tab has different functions. Above these tabs is a few buttons new, save, delete etc. In the save function, there is code that creates a note every time something is updated. For example "user A updated job at 12:48 PM". This save button is for any changes that are made in any tab that is opened. But when the tab 'Delivery Debrief' is open, I don't want this note to be created every time I updated something. In this tab the information gets updated a lot so there will be too many notes. So every time the save button is clicked this code is run:

 protected void btnSave_Click(object sender, EventArgs e)
    {
     string Note = Job.Compare(oldJob, new Job(int.Parse(Request.QueryString["JobID"])), Mod);
                                JobNote modNote = new JobNote
                                {
                                    JobID = job.ID,
                                    Company_ID = CurCompID,
                                    Date = DateTime.Now,
                                    Time = DateTime.Now,
                                    Note = Note,
                                    CreatedBy = CurrentUser.UserID,
                                    CreatedByName = CurrentUser.Username,
                                    NoteType = 1
                                };
                                modNote.Create();
}

Is there a way to stop this code running when the delivery debrief tab is open? The notes still need to be created for the other tabs.

Aucun commentaire:

Enregistrer un commentaire