保存取消按钮事件处理程序在Radscheduler高级插入表单中不起作用

时间:2017-08-17 16:22:39

标签: asp.net telerik

在我的应用程序中,我有一个radschedular,在创建新约会时我通过指定 StartInsertingInAdvancedForm =" True"

以提前模式打开

我的代码如下

的.aspx

<telerik:RadScheduler RenderMode="Lightweight" runat="server" ID="rs_course_schedule" CustomAttributeNames="Completed" 
                StartInsertingInAdvancedForm="True" StartEditingInAdvancedForm="True"
                FirstDayOfWeek="Monday" LastDayOfWeek="Friday" Reminders-Enabled="true" SelectedView="WeekView"
                RowHeight="30px" AppointmentStyleMode="Simple" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" 
                OnAppointmentCommand="rs_course_schedule_OnAppointmentCommand"
                OnAppointmentCreated="RadScheduler1_AppointmentCreated" OverflowBehavior="Auto" Skin="Web20" 
                OnAppointmentInsert="rs_course_schedule_OnAppointmentInsert">
                <AdvancedForm Modal="true"></AdvancedForm>
                <AppointmentTemplate>
                    <div class="appointmentHeader">
                        <asp:Panel ID="RecurrencePanel" CssClass="rsAptRecurrence" runat="server" Visible="false">
                        </asp:Panel>
                        <asp:Panel ID="RecurrenceExceptionPanel" CssClass="rsAptRecurrenceException" runat="server"
                            Visible="false">
                        </asp:Panel>
                        <asp:Panel ID="ReminderPanel" CssClass="rsAptReminder" runat="server" Visible="false">
                        </asp:Panel>
                        <%#Eval("Subject") %>
                    </div>
                    <div>
                        Assigned to: <strong>
                            <asp:Label ID="UserLabel" runat="server" Text='<%# Container.Appointment.Resources.GetResourceByType("Faculty") == null ? "None" : Container.Appointment.Resources.GetResourceByType("Faculty").Text %>'></asp:Label>
                        </strong>
                        <br />
                        <asp:CheckBox ID="CompletedStatusCheckBox" runat="server" Text="Completed? " TextAlign="Left"
                            Checked='<%# !String.IsNullOrEmpty(Container.Appointment.Attributes["Completed"]) && Boolean.Parse(Container.Appointment.Attributes["Completed"]) %>'
                            AutoPostBack="true" OnCheckedChanged="CompletedStatusCheckBox_CheckedChanged"></asp:CheckBox>
                    </div>
                </AppointmentTemplate>
                <ResourceStyles>
                    <telerik:ResourceStyleMapping Type="Faculty" Key="1" BackColor="red"></telerik:ResourceStyleMapping>
                    <telerik:ResourceStyleMapping Type="Faculty" Key="2" BackColor="Pink"></telerik:ResourceStyleMapping>
                    <telerik:ResourceStyleMapping Type="Faculty" Key="3" BackColor="OrangeRed"></telerik:ResourceStyleMapping>
                </ResourceStyles>
            </telerik:RadScheduler>

中的代码

    public partial class Schedule : System.Web.UI.UserControl
    {
        #region Object Instantiation
        readonly BEL_LMS _objLms = new BEL_LMS();
        readonly BL_LMS _blLms = new BL_LMS();
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PopulateSchedular();
                AddTeachers();
                SetDate();
            }
        }

        private void AddTeachers()
        {
            _objLms.ActivityId = Session["activity_id"].ToString();
            DataTable dtFaculty =  _blLms.AssignedFaculty(_objLms);
            ResourceType resources = new ResourceType("Faculty");
            if (dtFaculty.Rows.Count > 0)
            {
                resources.DataSource = dtFaculty;
                resources.KeyField = "userid";
                resources.TextField = "acct_name";
                resources.ForeignKeyField = "UserId";
                rs_course_schedule.ResourceTypes.Add(resources);
            }
        }

        private void SetDate()
        {
            rs_course_schedule.SelectedDate = DateTime.Now;
        }

        private void PopulateSchedular()
        {
            _objLms.Flag = "fetch";
            _objLms.ActivityId = "11";
            DataTable dtTable = _blLms.FetchScheduleForCourse(_objLms);
            if (dtTable.Rows.Count > 0)
            {
                rs_course_schedule.DataKeyField = "ID";
                rs_course_schedule.DataStartField = "Start";
                rs_course_schedule.DataEndField = "End";
                rs_course_schedule.DataSubjectField = "Subject";
                rs_course_schedule.DataDescriptionField = "Description";
                //rs_course_schedule.DataReminderField = "Reminder";
                rs_course_schedule.DataSource = dtTable;
                rs_course_schedule.DataBind();

            }
        }


        protected void CompletedStatusCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox CompletedStatusCheckBox = (CheckBox)sender;
            //Find the appointment object to directly interact with it
            SchedulerAppointmentContainer appContainer = (SchedulerAppointmentContainer)CompletedStatusCheckBox.Parent;
            Appointment appointment = appContainer.Appointment;
            _objLms.ActivityId = appointment.ID.ToString();
            _objLms.Flag = "update";
            int affectedRow = _blLms.UpdateCourse(_objLms); // update checkbox data for that particular schedule
            rs_course_schedule.Rebind();
        }

        protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            if (e.Appointment.Attributes["Completed"] == "True")
            {
                e.Appointment.BackColor = System.Drawing.Color.Red;
            }
        }

        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
        {

        }

        protected void rs_course_schedule_OnAppointmentInsert(object sender, AppointmentInsertEventArgs e)
        {
            SchedulerDataSource.InsertParameters["End"].DefaultValue = e.Appointment.End.ToString();
            SchedulerDataSource.InsertParameters["Start"].DefaultValue = e.Appointment.Start.ToString();
            SchedulerDataSource.InsertParameters["Subject"].DefaultValue = e.Appointment.Start.ToString();
            SchedulerDataSource.InsertParameters["Description"].DefaultValue = e.Appointment.Description;
            SchedulerDataSource.InsertParameters["CourseID"].DefaultValue = "1";
            //SchedulerDataSource.InsertParameters["User"].DefaultVal;
        }


        protected void rs_course_schedule_OnAppointmentCommand(object sender, AppointmentCommandEventArgs e)
        {
            string name = e.CommandName;
        }
    }
} 

现在,当我尝试插入新约会时,此表单正在打开 enter image description here

但是在“保存并取消”按钮中没有单击...

我如何解决这个问题?

0 个答案:

没有答案