How to replace "args.Element.AddClass" in Scheduler

Hi everybody,

   I tried to replace "args.Element.AddClass" in my scheduler app, which was working fine in Ver. 18.2 :
       
public string[] CustomClass = {"custom-class"};
	public void OnEventRendered(EventRenderedArgs<SchedStuPla> args)
 	{
		if (args.Data.CategoryColor.Trim() == "green")
		{
			// args.Element.AddClass(CustomClass);
			args.CssClasses.Add("custom-class");
			BgColor = "#2C7E04";
		}	
	} 
Using this solution I get a System.NullReferenceException.
Could somebody please tell me how to replace args.Element.AddClass(CustomClass) correctly ?
   Thanks
     regards
       Uwe



        

1 Reply 1 reply marked as answer

BS Balasubramanian Sattanathan Syncfusion Team October 9, 2020 11:47 AM UTC

Hi Uwe Hein, 
 
Greetings from Syncfusion Support. 
 
We have validated your reported scenario “How to replace "args.Element.AddClass" in Scheduler” at our side and let you know that the args.Element has been deprecated from version 18.3.35. So we would suggest you to change the appointment color like the below code snippet.  
 
Code snippet:  
public List<string> CustomClass = new List<string>() { "custom-class" }; 
public void OnEventRendered(EventRenderedArgs<AppointmentData> args) 
{ 
    args.CssClasses = CustomClass; 
} 
 
 
Kindly refer to the above links and let us know if you need further assistance. 
 
Regards, 
Balasubramanian S 


Marked as answer
Loader.
Up arrow icon