This is a migrated thread and some comments may be shown as answers.

AdvancedInsertTemplate does not close after save

6 Answers 179 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dick Arlbring
Top achievements
Rank 1
Dick Arlbring asked on 09 Apr 2010, 12:12 PM
Hello
I'm using the AdvancedInserttemplate but it does not close when I push the save button.
I'm not using the datasource to do the insert, I'm using the serverside RadScheduler1_AppointmentInsert.
It does the insert, but the advancedInsert form is still visible after the insert.

Kind Regards,
Dick

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Apr 2010, 12:36 PM
Hello Dick,

Please, try calling RadScheduler's Rebind() method at the end of the AppointmentInsert handler.

Kind regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Dick Arlbring
Top achievements
Rank 1
answered on 09 Apr 2010, 01:00 PM
Thank you!
That solved the problem
0
Enigma
Top achievements
Rank 1
answered on 23 Apr 2010, 03:00 AM
Hi Dick,

I have a quick question for you.   I see that you used AdvancedInsert event to add the appointment.  How did you access the controls on the advanced insert form in the method?

Thanks,
Mans.
0
Dick Arlbring
Top achievements
Rank 1
answered on 23 Apr 2010, 06:30 AM
Hi Mans

I don't think I access so many controls, I just make an ordinary insert into my database.
And after that I make the rebind() so the form will close and changes will be visible.

First I use this

RadScheduler1_FormCreated(

ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated

 

and use the following to get the data I need
 - e.Appointment.ID.ToString (only for the update)
- e.Appointment.Start

 

 

- e.Appointment.End

I use these values to populate asp.net form field in the advanced insert form, so they can be requested  in event below.
Probably not the so nice, but It works.

 

RadScheduler1_AppointmentInsert(

ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerCancelEventArgs)
strStart=request("startTime")

 


/Dick
0
Enigma
Top achievements
Rank 1
answered on 23 Apr 2010, 06:52 AM
Hi Dick,

Thanks for the response.

In form created I am able to get to the fields no problem.
 
    protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e)  
        {  
            if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)  
            {  
                RadDateTimePicker start = (RadDateTimePicker)e.Container.FindControl("StartInput");  
                RadDateTimePicker end = (RadDateTimePicker)e.Container.FindControl("EndInput");  
                HtmlGenericControl divError = (HtmlGenericControl)e.Container.FindControl("divErrorInsert");  
          }               
     } 

And on Appointment Command, I can retrieve data and do the processing no problem.  The issue is that if the insert/update fails I want to show the user an error message and not close the popup.  For some darn reason the popup always closes even on failure.

        protected void RadScheduler1_AppointmentCommand(object sender, Telerik.Web.UI.AppointmentCommandEventArgs e)  
        {  
            HtmlGenericControl divError = (HtmlGenericControl)e.Container.FindControl("divErrorInsert");  
            divError.Visible = false;  
            try  
            {                  
                if (e.CommandName.ToLower() == "insert")  
                {  
                    RadComboBox comboJob = (RadComboBox)e.Container.FindControl("RadComboBoxJob");  
                    RadDateTimePicker start = (RadDateTimePicker)e.Container.FindControl("StartInput");  
                    RadDateTimePicker end = (RadDateTimePicker)e.Container.FindControl("EndInput");                      
 
                    using (MyDataContext db = new MyDataContext())  
                    {  
                        Schedule newnewSchedule = new Schedule();  
                         newnewSchedule.JobID = new Guid(comboJob.SelectedValue);    
                        newSchedule.StartTime = startTime;  
                        newSchedule.EndTime = endTime;  
                        db.Schedules.InsertOnSubmit(newSchedule);  
                        db.SubmitChanges();  
                    }  
                }  
            }  
            catch (Exception ex)  
            {  
                Literal ltlError = (Literal)e.Container.FindControl("divErrorInsert");  
                ltlError.Text = ex.Message;  
                this.CancelInsertEdit = true;    // This is a global class varitable              
            }  
        } 

and then in AppointmentInsert I am doing this which is not working.

        protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
        {  
            if (this.CancelInsertEdit.HasValue && this.CancelInsertEdit.Value)  
                e.Cancel = true;  
        } 
0
Enigma
Top achievements
Rank 1
answered on 23 Apr 2010, 07:04 AM
Ok, there was a casting error in the catch block.  This is now working.

Thanks,
Mans
Tags
Scheduler
Asked by
Dick Arlbring
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dick Arlbring
Top achievements
Rank 1
Enigma
Top achievements
Rank 1
Share this question
or