Custom LightBox Form in MVC project

Hello,

I am new to your product and so far I love it. You have done a fantastic job. Here is my question:

I have an MVC 4 project and I am trying to implement a custom lightbox form. I am following the MVCFormInLightbox example that came with the DHXScheduler.MVC4 project. Here is what I have so far:

I have a partial view (SchedulerEventFormPartial.cshtml) in the Views/Partial directory
The view has the same exact html code from the example
In the controller, I am creating the new box as such: var form = scheduler.Lightbox.SetExternalLightboxForm("SchedulerEventFormPartial", 640, 180);

Note: I have a custom view engine that looks in the Partial directory to find views.

When I run the code and try to modify an event, I am getting a 404 error in the iFrame. I know the view is there so I do not understand why the scheduler cannot find it. I tried different path combinations (full path to the file, Server.MapPath, etc) with the same result.

Any help will be greatly appreciated.

Thank you,
Daniel

Hello,
please note that custom form’s iframe prepends url with ‘/’,
e.g. if you attach view like following
scheduler.Lightbox.SetExternalLightboxForm(“SchedulerEventFormPartial”, 640, 180);
on the client iframe will have following value - src="/SchedulerEventFormPartial"

Aleksandr,
Thank you for your reply. I tried different combination but nothing seems to work for me. Considering that my partial view is located in Views/Partial/SchedulerEventFormPartial, how would you construct the path to use in the SetExternalLightboxForm call?

I tried Views/Partial/SchedulerEventFormPartial hoping that the prefixing with / will force it to start from the root, but instead it appends the path to the path to the controller as such:
sitename.com/Controller/Views/Partial/SchedulerEventFormPartial which does not work either.

Thank you.

Hello,
can you provide a demo?
I’ve just tested it on local samples, and i’ve got the following
c#: scheduler.Lightbox.SetExternalLightboxForm("Views/Partial/SchedulerEventFormPartial", 640, 180);
client side request: http://localhost:8055/Views/Partial/SchedulerEventFormPartial

I am getting the same error.

I have created a partial view and I am getting the following error :

Server Error in ‘/’ Application.

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /PartialFormView/BookRoom

please provide a demo, it would really help to solve the problem

I am now able to open the custom lightbox.

I more question is how can I save the fields in database?Do I need to define the mapto attribute?
From the documentation ,I believe I need to define the getValue() and setValue() but how to define which field of the custom lightbox maps to which field in the database.

Please help.

Hi,
if you mean client side lightbox, as described here:
scheduler-net.com/docs/fully_cus … htbox.html

You don’t save field directly, at least this is not expected approach.
getValue should collect and return client-side appointment object(e.g. {id:1, text:"", start_date:…, end_date:…}),
then scheduler sends objects values to the server, request will hit Save method of the controller scheduler-net.com/docs/managing_ … ate_method
there you can save these values to the database. If you use LinqToSql or EntityFramework, mappings can be defined when you create model class

Thanks for your reply.

I am able to save the details in the database but I am not able to view my created events on the Timelineview but they are visible in the week view.

We are actually creating a POC for meeting room management and we are facing certain issues :
Issue#1 : We need to add a custom button(like next,previous) to the scheduler for changing the first hour and last hour of the scheduler so that we can show 24 hours but only the working hour in the default view.Is there any way we can do this?

Issue #2 : We need to provide a mouse over/tooltip to the y scale of the timeline to show the picture and other details of the room and also provide icons below the name of the room to show facilities available for the particular room.

Issue #3: Feature to Invite attendees and send Outlook meeting request once a meeting room is booked or update the meeting request if the event is updated or delete when the event is deleted.

it may be happening if you do not assing section id to the event
scheduler-net.com/docs/timelinev … o_the_view

Issue #1
in dhtmlxScheduler for .Net, the only way is to inject custom html into scheduler’s markup is to do it with js code after scheduler initialization.
You may also considering usage of fully client-side scheduler, it gives more control over the markup.
the button itself may trigger following code to toggle displayed hoursfunction(){ if(!scheduler.config.first_hour){ scheduler.config.first_hour = 8; scheduler.config.last_hour = 18; }else{ scheduler.config.first_hour = 0; scheduler.config.last_hour = 24; } scheduler.updateView(); }
Issue #2
there is no built in function for tooltips over timeline scale, so you’ll have to attach mouseover to the scale items with the client-side code. In handler you can get section id with scheduler.getActionData,
e.g.
function(domEvent){
var section_id = scheduler.getActionData(domEvent).section;
showTooltipForSection(section_id);//some custom function
}

Issue #3
we don’t have a ready solution, the best i can suggest at the moment is a link to related question on stackoverflow
stackoverflow.com/questions/4618 … ut-outlook