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

Cant use custom attributes

2 Answers 118 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
GOMES
Top achievements
Rank 1
GOMES asked on 02 Jun 2016, 01:26 PM

Hello,

I just started using your scheduler and cant get through this issue. I bound my scheduler with a custom webservice which send me an array of "tasks". Thing is, these "tasks" have many custom attributes that i'd like to be able to display/edit. So i modified the MyAppointmentInfo class with my own needs as follow :

class MyAppointmentInfo
   {
       private int _id;
       private string _scode;
       private string _subject;
       private DateTime _start;
       private DateTime _end;
       private string _recurrenceRule;
       private string _recurrenceParentId;
       private string _reminder;
       private int? _userID;
       private int? _ressourceid;
       private int _backcolor;
       private string _description;
       private double _dtlength;
       private int _itimeslotbegin;
       private int _itimeslotend;
       private int _ifrozen;
       private double _dtvaliditybegin;
       private double _dtvalidityend;
       private double _dtrealbegin;
       private double _dtrealend;
       private int _itype;
       private int _isubtype;
       private int _istatus;
       private int _iresid;
       private string _sresname;
       private int _igroid;
       private int _isiteid;
       private int _iurgency;
       private int _iresfixed;
       private int _ialarm;
       private int _icolor;
       private int _iprofilsending;
       private string _saddress;
       private string _saddress2;
       private string _szipcode;
       private string _scity;
       private string _scountry;
       private double _dlati;
       private double _dlongi;
       private int _iradius;
       private int _igeoquality;
       private double _dkmbefore;
       private double _dttimebefore;
       private string _sspecialities;
       private double _dquantity;
       private int _tag;
       private string _smotifdeletion;
       private int _iuseridcreation;
       private double _dtusercreation;
       private int _iuseridlastchange;
       private double _dtuseridlastchange;

I then have a getter/setter for each of these properties. I do not display all of these properties on the advanced form only some of those but all these datas will be used later.

So i tried to create custom attributes for the properties i wanted to display/edit in the advanced form. I did this operation using :

CustomAttributeNames="sAddress,sAddress2,sZipCode,sCity,sCountry"

Even if i set EnableCustomAttributeEditing to true, no control is created in my advanced form. So i created it using (one for each of the properties above) : 

<telerik:RadTextBox runat="server" ID="sAddress2" TextMode="SingleLine" Columns="50" LabelCssClass="rfbLabel" Rows="5" Width="80%" Label="Adresse 2" Text='<%# Eval("sAddress2")%>' RenderMode="Lightweight" />

This way, when i get appointments from my webservice, these are displayed correctly on my scheduler and when clicked, displays the datas i want (including the custom attributes) in the advanced form.

But when i create a new appointment, i cant find any of these attributes in my e.appointment object when AppointmentInsert is triggered. The attribute count is 0.

Here is my RadScheduler1_AppointmentInsert code :

protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
        {
             // I create a "task" from the e.Appointment object
             // before sending it to my WebService
             WS_Task.TRMSTaskData newTask = GetTaskFromAppointment(e.Appointment);
             //Send newTask to my WebService           
 
        }
 private WS_Task.TRMSTaskData GetTaskFromAppointment(Appointment a)
        { // create an object "task" from an "Appointment"
            WS_Task.IRMSTaskservice ws = new WS_Task.IRMSTaskservice();
            WS_Task.TRMSSession se = new WS_Task.TRMSSession();
            se.UserId = 71;
            se.SessionId = 1;
            WS_Task.TRMSTaskData newTask = ws.GetNewTask(se);
            newTask.sName = a.Subject;
            newTask.id = Convert.ToInt32(a.ID);
            newTask.sDescr = a.Description;
            newTask.dtBegin = (a.Start).ToOADate();
            newTask.dtEnd = (a.End).ToOADate();
            newTask.dtLength = newTask.dtEnd - newTask.dtBegin;
            newTask.sResName = a.Resources.GetResourceByType("Ressource").Text;
            newTask.iResId = Convert.ToInt32(a.Resources.GetResourceByType("Ressource").Key);
            newTask.iGroId = GetResourceFromID(newTask.iResId).iGroupId;
            newTask.iUrgency = 0;
            newTask.iResFixed = 0;
            newTask.iAlarm = 0;
            //Here i cant find a way to get the address field content
            //newTask.sAddress = ???
 
            return newTask;
 
        }

I followed the instructions from this example : http://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/design-time/custom-resources-and-attributes but cant get this to work...

Let me know if you need any more details and thank you for your time

2 Answers, 1 is accepted

Sort by
0
GOMES
Top achievements
Rank 1
answered on 03 Jun 2016, 12:54 PM

Hi again,

I found a different approach to add custom attributes. And it works all right but I dont use the advanced form anymore. All I have now is the following aspx :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
 
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="Stylesheet" type="text/css" href="styles.css" />
    <title>Test</title>
</head>
 
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
 
 
        <telerik:RadScheduler ID="RadScheduler1" runat="server" DataDescriptionField="Description" DataEndField="End"
            DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId"
            DataStartField="Start" DataSubjectField="Subject" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
            SelectedDate="2016-05-23" OnFormCreated="RadScheduler1_FormCreated" CustomAttributeNames="Adresse, Adresse2, Code Postal, Ville, Pays">
 
            <AdvancedForm EnableCustomAttributeEditing="true" />
        </telerik:RadScheduler>
    </form>
</body>
</html>

And the code behind :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitializeResources();
            InitializeAppointments();
        }
 
    }
 
    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine(e.Appointment.Subject);
        WS_Task.IRMSTaskservice ws = new WS_Task.IRMSTaskservice();
        WS_Task.TRMSSession se = new WS_Task.TRMSSession();
        se.UserId = 71;
        se.SessionId = 1;
 
        WS_Task.TRMSTaskData newTask = GetTaskFromAppointment(e.Appointment);
 
        ws.SetTask(se, newTask);       
        InitializeAppointments();
    }
 
    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
        {
            // HERE
            Label Adresse = (Label)e.Container.FindControl("AttrAdresse");
            Adresse.Text = "Hello";
            //I tried these two following lines but it will just add another label keeping the old one
            //RadTextBox attrAdresseTextbox =(RadTextBox)e.Container.FindControl("AttrAdresse");
            //attrAdresseTextbox.Label = "Modified";
        }
    }
 
    private void InitializeAppointments()
    {
        RadScheduler1.DataSource = Appointments;
    }
 
    private void InitializeResources()
    {
 
        ResourceType resType = new ResourceType("Ressource");
        resType.ForeignKeyField = "RessourceID";
 
        //To get a resources array using WebService WS_Res
 
        WS_Res.IRMSHRESOURCEservice ws = new WS_Res.IRMSHRESOURCEservice();
        WS_Res.TRMSSession se = new WS_Res.TRMSSession();
        se.UserId = 71;
        se.SessionId = 1;
 
        WS_Res.TRMSHResourceData[] resources = ws.GetHResourcesEx(se);
 
        RadScheduler1.ResourceTypes.Add(resType);
 
        for (int i = 0; i < resources.Length; i++)
        {
            RadScheduler1.Resources.Add(new Resource("Ressource", resources[i].iID, resources[i].sName));
        }
    }
 
    private List<MyAppointmentInfo> Appointments
    {
        get
        {
            //To get a list of "tasks" using WebService WS_Task
 
            WS_Task.IRMSTaskservice ws = new WS_Task.IRMSTaskservice();
            WS_Task.TRMSSession se = new WS_Task.TRMSSession();
            se.UserId = 71;
            se.SessionId = 1;
            int[] ResArray = new int[1] { 174 };
 
            WS_Task.TRMSTaskData[] tasks = ws.GetTasks(se, (DateTime.UtcNow.AddDays(-100)).ToOADate(), (DateTime.UtcNow.AddDays(2)).ToOADate(), ResArray);
 
            List<MyAppointmentInfo> sessApts = new List<MyAppointmentInfo>();
 
            //Loop on tasks array to put every item in sessApts List
            foreach (WS_Task.TRMSTaskData task in tasks)
            {
                MyAppointmentInfo ai = new MyAppointmentInfo(task);
                sessApts.Add(ai);
            }
 
            return sessApts;
        }
    }
 
    private WS_Task.TRMSTaskData GetTaskFromAppointment(Appointment a)
    {
        // send back a task intialized with Appointment a
        WS_Task.IRMSTaskservice ws = new WS_Task.IRMSTaskservice();
        WS_Task.TRMSSession se = new WS_Task.TRMSSession();
        se.UserId = 71;
        se.SessionId = 1;
        WS_Task.TRMSTaskData newTask = ws.GetNewTask(se);
        //WS_Task.TRMSTaskData newTask = new WS_Task.TRMSTaskData();
        newTask.sName = a.Subject;
        newTask.id = Convert.ToInt32(a.ID);
        newTask.sCode = null;
        newTask.sDescr = a.Description;
        newTask.dtBegin = (a.Start).ToOADate();
        newTask.dtEnd = (a.End).ToOADate();
        newTask.dtLength = newTask.dtEnd - newTask.dtBegin;
        newTask.iTimeSlotBegin = 0;
        newTask.iTimeSlotEnd = 0;
        newTask.iFrozen = 0;
        newTask.dtValidityBegin = 0;
        newTask.dtValidityEnd = 0;
        newTask.dtRealBegin = 0;
        newTask.dtRealEnd = 0;
        newTask.iType = 0;
        newTask.iSubType = 0;
        newTask.iStatus = 0;
        newTask.sResName = a.Resources.GetResourceByType("Ressource").Text;
        newTask.iResId = Convert.ToInt32(a.Resources.GetResourceByType("Ressource").Key);
        newTask.iGroId = GetResourceFromID(newTask.iResId).iGroupId;
        newTask.iSiteId = 0;
        newTask.iUrgency = 0;
        newTask.iResFixed = 0;
        newTask.iAlarm = 0;
        newTask.iColor = 0;
        newTask.iProfilSending = 0;
        newTask.sAddress = a.Attributes["Adresse"];
        newTask.sAddress2 = a.Attributes["Adresse2"];
        newTask.sZipCode = a.Attributes["Code Postal"];
        newTask.sCity = a.Attributes["Ville"];
        newTask.sCountry = a.Attributes["Pays"];
        newTask.dLati = 0;
        newTask.dLongi = 0;
        newTask.iRadius = 0;
        newTask.iGeoQuality = 0;
        newTask.dKMBefore = 0;
        newTask.dtTimeBefore = 0;
        newTask.sSpecialities = null;
        newTask.dQuantity = 0;
        newTask.Tag = 0;
        newTask.sMotifDeletion = null;
        newTask.iUserIdCreation = 0;
        newTask.dtUserCreation = 0;
        newTask.iUserIdLastChange = 0;
        newTask.dtUserIdLastChange = 0;
 
        return newTask;
 
    }
 
    private WS_Res.TRMSHResourceData GetResourceFromID(int _id)
    {
           //Get a resources list using my webservice 
        WS_Res.IRMSHRESOURCEservice ws = new WS_Res.IRMSHRESOURCEservice();
        WS_Res.TRMSSession se = new WS_Res.TRMSSession();
        se.UserId = 71;
        se.SessionId = 1;
 
        WS_Res.TRMSHResourceData[] resources = ws.GetHResourcesEx(se);
 
        foreach (WS_Res.TRMSHResourceData resource in resources)
        {
            if (resource.iID == _id)
            {
                return resource;
            }
        }
        return null;
    }
 
    class MyAppointmentInfo
    {
        private int _id;
        private string _scode;
        private string _subject;
        private DateTime _start;
        private DateTime _end;
        private string _recurrenceRule;
        private string _recurrenceParentId;
        private string _reminder;
        private int? _userID;
        private int? _ressourceid;
        private int _backcolor;
        private string _description;
        private double _dtlength;
        private int _itimeslotbegin;
        private int _itimeslotend;
        private int _ifrozen;
        private double _dtvaliditybegin;
        private double _dtvalidityend;
        private double _dtrealbegin;
        private double _dtrealend;
        private int _itype;
        private int _isubtype;
        private int _istatus;
        private int _iresid;
        private string _sresname;
        private int _igroid;
        private int _isiteid;
        private int _iurgency;
        private int _iresfixed;
        //equivalent à reminder ?
        private int _ialarm;
        private int _icolor;
        private int _iprofilsending;
        private string _saddress;
        private string _saddress2;
        private string _szipcode;
        private string _scity;
        private string _scountry;
        private double _dlati;
        private double _dlongi;
        private int _iradius;
        private int _igeoquality;
        private double _dkmbefore;
        private double _dttimebefore;
        private string _sspecialities;
        private double _dquantity;
        private int _tag;
        private string _smotifdeletion;
        private int _iuseridcreation;
        private double _dtusercreation;
        private int _iuseridlastchange;
        private double _dtuseridlastchange;
 
 
        public int ID
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
 
        public string sCode
        {
            get
            {
                return _scode;
            }
            set
            {
                _scode = value;
            }
        }
 
        public string Subject
        {
            get
            {
                return _subject;
            }
            set
            {
                _subject = value;
            }
        }
 
        public DateTime Start
        {
            get
            {
                return _start;
            }
            set
            {
                _start = value;
            }
        }
 
        public DateTime End
        {
            get
            {
                return _end;
            }
            set
            {
                _end = value;
            }
        }
 
        public string RecurrenceRule
        {
            get
            {
                return _recurrenceRule;
            }
            set
            {
                _recurrenceRule = value;
            }
        }
 
        public string RecurrenceParentID
        {
            get
            {
                return _recurrenceParentId;
            }
            set
            {
                _recurrenceParentId = value;
            }
        }
 
        public string Reminder
        {
            get
            {
                return _reminder;
            }
            set
            {
                _reminder = value;
            }
        }
 
        public int? UserID
        {
            get
            {
                return _userID;
            }
            set
            {
                _userID = value;
            }
        }
 
        public string Description
        {
            get
            {
                return _description;
            }
            set
            {
                _description = value;
            }
        }
 
        public double dtLength
        {
            get
            {
                return _dtlength;
            }
            set
            {
                _dtlength = value;
            }
        }
 
        public int iTimeSlotBegin
        {
            get
            {
                return _itimeslotbegin;
            }
            set
            {
                _itimeslotbegin = value;
            }
        }
 
        public int iTimeSlotEnd
        {
            get
            {
                return _itimeslotend;
            }
            set
            {
                _itimeslotend = value;
            }
        }
 
        public int iFrozen
        {
            get
            {
                return _ifrozen;
            }
            set
            {
                _ifrozen = value;
            }
        }
 
        public double dtValidityBegin
        {
            get
            {
                return _dtvaliditybegin;
            }
            set
            {
                _dtvaliditybegin = value;
            }
        }
 
        public double dtValidityEnd
        {
            get
            {
                return _dtvalidityend;
            }
            set
            {
                _dtvalidityend = value;
            }
        }
 
        public double dtRealBegin
        {
            get
            {
                return _dtrealbegin;
            }
            set
            {
                _dtrealbegin = value;
            }
        }
 
        public double dtRealEnd
        {
            get
            {
                return _dtrealend;
            }
            set
            {
                _dtrealend = value;
            }
        }
 
        public int iType
        {
            get
            {
                return _itype;
            }
            set
            {
                _itype = value;
            }
        }
 
        public int iSubType
        {
            get
            {
                return _isubtype;
            }
            set
            {
                _isubtype = value;
            }
        }
 
        public int iStatus
        {
            get
            {
                return _istatus;
            }
            set
            {
                _istatus = value;
            }
        }
 
        public int iResId
        {
            get
            {
                return _iresid;
            }
            set
            {
                _iresid = value;
            }
        }
 
        public string sResName
        {
            get
            {
                return _sresname;
            }
            set
            {
                _sresname = value;
            }
        }
 
        public int iGroId
        {
            get
            {
                return _igroid;
            }
            set
            {
                _igroid = value;
            }
        }
 
        public int iSiteId
        {
            get
            {
                return _isiteid;
            }
            set
            {
                _isiteid = value;
            }
        }
 
        public int iUrgency
        {
            get
            {
                return _iurgency;
            }
            set
            {
                _iurgency = value;
            }
        }
 
        public int iResFixed
        {
            get
            {
                return _iresfixed;
            }
            set
            {
                _iresfixed = value;
            }
        }
 
        public int iAlarm
        {
            get
            {
                return _ialarm;
            }
            set
            {
                _ialarm = value;
            }
        }
 
        public int iColor
        {
            get
            {
                return _icolor;
            }
            set
            {
                _icolor = value;
            }
        }
 
        public int iProfilSending
        {
            get
            {
                return _iprofilsending;
            }
            set
            {
                _iprofilsending = value;
            }
        }
 
        public string sAddress
        {
            get
            {
                return _saddress;
            }
            set
            {
                _saddress = value;
            }
        }
 
        public string sAddress2
        {
            get
            {
                return _saddress2;
            }
            set
            {
                _saddress2 = value;
            }
        }
 
        public string sZipCode
        {
            get
            {
                return _szipcode;
            }
            set
            {
                _szipcode = value;
            }
        }
 
        public string sCity
        {
            get
            {
                return _scity;
            }
            set
            {
                _scity = value;
            }
        }
 
        public string sCountry
        {
            get
            {
                return _scountry;
            }
            set
            {
                _scountry = value;
            }
        }
 
        public double dLati
        {
            get
            {
                return _dlati;
            }
            set
            {
                _dlati = value;
            }
        }
 
        public double dLongi
        {
            get
            {
                return _dlongi;
            }
            set
            {
                _dlongi = value;
            }
        }
 
        public int iRadius
        {
            get
            {
                return _iradius;
            }
            set
            {
                _iradius = value;
            }
        }
 
        public int iGeoQuality
        {
            get
            {
                return _igeoquality;
            }
            set
            {
                _igeoquality = value;
            }
        }
 
        public double dKMBefore
        {
            get
            {
                return _dkmbefore;
            }
            set
            {
                _dkmbefore = value;
            }
        }
 
        public double dtTimeBefore
        {
            get
            {
                return _dttimebefore;
            }
            set
            {
                _dttimebefore = value;
            }
        }
 
        public string sSpecialities
        {
            get
            {
                return _sspecialities;
            }
            set
            {
                _sspecialities = value;
            }
        }
 
        public double dQuantity
        {
            get
            {
                return _dquantity;
            }
            set
            {
                _dquantity = value;
            }
        }
 
        public int Tag
        {
            get
            {
                return _tag;
            }
            set
            {
                _tag = value;
            }
        }
 
        public string sMotifDeletion
        {
            get
            {
                return _smotifdeletion;
            }
            set
            {
                _smotifdeletion = value;
            }
        }
 
        public int iUserIdCreation
        {
            get
            {
                return _iuseridcreation;
            }
            set
            {
                _iuseridcreation = value;
            }
        }
 
        public double dtUserCreation
        {
            get
            {
                return _dtusercreation;
            }
            set
            {
                _dtusercreation = value;
            }
        }
 
        public int iUserIdLastChange
        {
            get
            {
                return _iuseridlastchange;
            }
            set
            {
                _iuseridlastchange = value;
            }
        }
 
        public double dtUserIdLastChange
        {
            get
            {
                return _dtuseridlastchange;
            }
            set
            {
                _dtuseridlastchange = value;
            }
        }
 
        public int? RessourceId
        {
            get
            {
                return _ressourceid;
            }
            set
            {
                _ressourceid = value;
            }
        }
 
 
        public MyAppointmentInfo()
        {
            //_id = Guid.NewGuid().ToString();
        }
 
 
        public MyAppointmentInfo(WS_Task.TRMSTaskData task) : this()
        {
            _id = task.id;
            _subject = task.sName;
            _start = DateTime.FromOADate(task.dtBegin);
            _end = DateTime.FromOADate(task.dtEnd);
            _recurrenceRule = string.Empty;
            _recurrenceParentId = null;
            _reminder = string.Empty;
            _description = task.sDescr;
            _dtlength = task.dtLength;
            _itimeslotbegin = task.iTimeSlotBegin;
            _itimeslotend = task.iTimeSlotEnd;
            _ifrozen = task.iFrozen;
            _dtvaliditybegin = task.dtValidityBegin;
            _dtvalidityend = task.dtValidityEnd;
            _dtrealbegin = task.dtRealBegin;
            _dtrealend = task.dtRealEnd;
            _itype = task.iType;
            _isubtype = task.iSubType;
            _istatus = task.iStatus;
            _iresid = task.iResId;
            _sresname = task.sResName;
            _igroid = task.iGroId;
            _isiteid = task.iSiteId;
            _iurgency = task.iUrgency;
            _iresfixed = task.iResFixed;
            //equivalent à reminder ?
            _ialarm = task.iAlarm;
            _icolor = task.iColor;
            _iprofilsending = task.iProfilSending;
            _saddress = task.sAddress;
            _saddress2 = task.sAddress2;
            _szipcode = task.sZipCode;
            _scity = task.sCity;
            _scountry = task.sCountry;
            _dlati = task.dLati;
            _dlongi = task.dLongi;
            _iradius = task.iRadius;
            _igeoquality = task.iGeoQuality;
            _dkmbefore = task.dKMBefore;
            _dttimebefore = task.dtTimeBefore;
            _sspecialities = task.sSpecialities;
            _dquantity = task.dQuantity;
            _tag = task.Tag;
            _smotifdeletion = task.sMotifDeletion;
            _iuseridcreation = task.iUserIdCreation;
            _dtusercreation = task.dtUserCreation;
            _iuseridlastchange = task.iUserIdLastChange;
            _dtuseridlastchange = task.dtUserIdLastChange;
 
        }
 
        public MyAppointmentInfo(Appointment source) : this()
        {
            CopyInfo(source);
 
        }
 
        public void CopyInfo(Appointment source)
        {
            Subject = source.Subject;
            Description = source.Description;
            Start = source.Start;
            End = source.End;
            RecurrenceRule = source.RecurrenceRule;
            if (source.RecurrenceParentID != null)
            {
                RecurrenceParentID = source.RecurrenceParentID.ToString();
            }
 
            if (!String.IsNullOrEmpty(Reminder))
            {
                Reminder = source.Reminders[0].ToString();
            }
 
            Resource user = source.Resources.GetResourceByType("User");
            if (user != null)
            {
                UserID = (int?)user.Key;
            }
            else
            {
                UserID = null;
            }
        }
 
    }
}

I simplified the code as much as i could to make it as clear as possible for you. Now that I can get all the attributes I want I cant customize the advanced form because i dont use the ascx file.

Questions are : When i use this approach how can I customize the advanced form (can i add button, checkboxes, hide or display a textbox depending on a checkbox state etc ?) Always with this approach, how can i change the custom attributes textbox labels ? When i use the FindControls method on my "attrAdresse" attribute, it'll find the control but its label is empty. This sais, i can see a label "Adresse" on my advanced form. So if I do attrAdresseTextbox.Label = "Modified", it'll add the label "Modified" right after "Adresse" which is not what i'm looking for...

With my first approach, question's still the same. How to add new custom attributes and bind them to my appointment ?

 

Regards

0
Plamen
Telerik team
answered on 07 Jun 2016, 07:19 AM
Hello,

If you don't use the Advanced Template approach you can use the FormCreated event to find and update the label of the custom attribute as for example it is done in the code below:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
   {
       if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
       {
           RadTextBox txtApptFirstName = e.Container.FindControl("AttrAnnotations") as RadTextBox;
 
           if (txtApptFirstName != null)
           {
               txtApptFirstName.Enabled = false;
               LiteralControl literal = (txtApptFirstName.Parent.Controls[0].Controls[0] as LiteralControl);
 
               if (literal != null)
               {
                   literal.Text = "First Name";
               }
           }
       }
   }

You can also consider finding the controls from the client side as it is described here.


Regards,
Plamen
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Scheduler
Asked by
GOMES
Top achievements
Rank 1
Answers by
GOMES
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or