Appointment Customization

Hi,

into a scheduler, I’d like to:

  1. Customize background color of my appointment
  2. Customize description of my appointment

How can I do that with .Net Razor Engine?

Regards.

Hi,
1)background color is defined by the ‘color’ property of the appointment, check the ‘Custom Field’ sample from the package

2)you can override default template for event description
scheduler-net.com/docs/dhxschedu … lates.html

Great!

Last question…
how can i add 2 property into an appointment?
Example: Subject + room?

Hi,
you need to add these properties to your model, and then attach appropriate controls to the lightbox, e.g.

var select = new LightboxSelect("room_id", "Room"); var items = new List<object>(){ new { key = "1", label = "Room 1" }, new { key = "2", label = "Room 2" }, new { key = "3", label = "Room 3"} }; select.AddOptions(items); scheduler.Lightbox.Add(select);about this code,

new LightboxSelect("room_id", "Room"); first parameter defines control name(which will be needed if you are going to manage lightbox on the client)
by default control will be mapped to the property with the same name as a itself(ie control above will be mapped to room_id property). You can map it to the other property
LightboxSelect.MapTo = “property name”;
The second parameter set for controls label

select.AddOptions(items);

objects passed to AddOption(s) should have both ‘key’ and ‘label’ properties, ‘key’ defines option value, label - option text

also here is some doc about lightbox configuration
scheduler-net.com/docs/lightbox.html

Hi,

ty for your reply.
But I’d like to write into the label of the appointment 2 data
Description of the appointment + vbcrlf + Room.

Regards.

then you need to override templates for event’s text(agenda and month view use different templates, so you’ll need to redefine them as well),

js:

function overrideTemplates(){ scheduler.templates.event_text = scheduler.templates.agenda_text = scheduler.templates.event_bar_text = function(start,end,ev){ return ev.text + '</br>' + getRoom(ev.room_id); }; } where getRoom is a function that should retrieve room label by it’s id
controller:

scheduler.BeforeInit= new List<string>(){ "overrideTemplates();"};//this code will call 'overrideTemplates' function right before schedulers initialization on the client

I am looking at Custom Field Example, but i don’t want to change font color.
I’ d like to change background color.

Is it possible? (razor engine in label appointment)

You need to add ‘color’ property to the model
‘color’ defines appointment background,
‘textColor’ defines font color

In CustomField sample, try to replace all occurences of “textColor” by “color”, and also rename textColor property of the ColoredEvent model

var check = new LightboxCheckbox("highlighting", "Important"); check.MapTo = "textColor";

actionValues["textColor"]

–>

var check = new LightboxCheckbox("highlighting", "Important"); check.MapTo = "color";

actionValues["color"]

Hi,

I try and I ve got last problem.
I have a combo box that change color of my appointment, not a combo.
I attach my code… could you che it?
Color change but only when I load data, not when I save them.

Regards.
Color.zip (1.78 KB)

Which definitions of color could I insert?
Should I upload images too?

there should be one more line to enable server-side updates

scheduler.EnableDataprocessor = true; scheduler.Data.DataProcessor.UpdateFieldsAfterSave = true;//<--here it is

you can use any css color format( hex, rgb, color names),
all of this definitions will be valid

event.color = "#ff0000"; //OR event.color = "rgb(255,0,0)"; //OR event.color = "red";

Great!

ty.