Setting Resource Value in Code Behind

2 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    Aug 2010

    Posted 17 Sep 2012 Link to this post

    How would one set the value for a resource in the code behind (specifically for the Simple Form, not the Advanced Form)

    I've tried the following with no luck . . . .

    public void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
    {
        if (e.Appointment.Attributes["Employee"] == string.Empty)
        {
            e.Appointment.Attributes["Employee"] = "555";
        }
    }
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2053 posts

    Posted 19 Sep 2012 Link to this post

    Hello Joseph,

    Modifying an appointment attribute in the inline insert form("Simple Form") could be proceed in OnFormCreated event. Here you can find more information about this event and its properties.

    The issue that you are having with setting a value to your appointment attribute seems to be caused by the "if statement". If an attribute is not exist its value is null which is different than String.Empty.

    protected void RadScheeduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
        {
            if (e.Appointment.Attributes["Employee"] == null)
            {
                e.Appointment.Attributes["Employee"] = "444";
            }
        }

    Hope this will be helpful.

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top