my event created did not save in the database

Hello,

I have a problem where I’m using dhtmlxScheduler to do the calendar booking. I’m using website application not mvc. So I have created generic handlers for my website. But, when i run the website and create the event, the event did not saved, not only did not save on that calendar but also in the database. I don’t know where i’m wrong. Please somebody help me.

Hi,
post code of .ashx that saves events (or attach the file itself),
and dataProcessor initialization code, please

(.ashx)

<%@ WebHandler Language="C#"Class=“dhtmlxConnector.NET.dhtmlxScheduler.SchedulerConnector” %>

using System;
using System.Web;
using dhtmlxConnectors;
using System.Configuration;
using System.Linq;
using System.Web.Services;
using System.Collections.Generic;

namespace dhtmlxConnector.NET.dhtmlxScheduler
{
///


/// Connector body
///

[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class SchedulerConnector : dhtmlxRequestHandler
{
    public override IdhtmlxConnector CreateConnector(HttpContext context)
    {
        var connector = new dhtmlxSchedulerConnector(
           "Events",
           "ID",
           dhtmlxDatabaseAdapterType.SqlServer2005,
           ConfigurationManager.ConnectionStrings["PVIC_DB"].ConnectionString,
           "DateStart",
           "DateEnd",
           "MeetingTitle as text"
        );
        return connector;
    }
}

}

(dataProcessor initialization code)
(Sorry about the messy code. I have to add image button too on that page)

<%@ Page Language=“C#” AutoEventWireup=“true” CodeFile=“Calendar.aspx.cs” Inherits=“Calendar” %>

Booking Calendar
<script src="dhtmlxScheduler/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
<script src="dhtmlxScheduler/codebase/ext/dhtmlxscheduler_recurring.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" src="Scripts/connector.js"></script>

<link href="dhtmlxScheduler/codebase/dhtmlxscheduler.css" rel="Stylesheet" type="text/css" charset="utf-8" />
<link href="dhtmlxScheduler/codebase/ext/dhtmlxscheduler_recurring.css" rel="Stylesheet" type="text/css" charset="utf-8" />

<style type="text/css" media="screen">
html, body
{
    height:100%;
    padding:0px;
    margin:0px;
    overflow:hidden;
}
    .style1
    {
        height: 21px;
        width: 1201px;
    }
    .style2
    {
        height: 20px;
        width: 141px;
    }
    .style11
    {
        width: 38px;
        font-size: large;
    }
    .style14
    {
        height: 4px;
        width: 188px;
        text-decoration: none;
    }
    .style16
    {
        height: 4px;
        width: 190px;
        text-align: center;
    }
    .style35
    {
        height: 4px;
        width: 145px;
        text-align: center;
    }
    .style36
    {
        width: 141px;
    }
    .style37
    {
        width: 141px;
        text-align: center;
    }
    .style39
    {
        height: 4px;
        width: 145px;
    }
    .style40
    {
        height: 4px;
        width: 141px;
        text-align: center;
    }
    .style41
    {
        width: 190px;
    }
    .style47
    {
        height: 4px;
        width: 138px;
    }
    .style49
    {
        height: 4px;
        width: 296px;
        text-align: center;
    }
    .style50
    {
        width: 296px;
    }
    .style51
    {
        height: 4px;
        width: 196px;
    }
</style>

<script type="text/javascript" charset="utf-8">
    function init() {

        scheduler.config.xml_date = "%Y-%m-%d %H:%i";


        scheduler.config.lightbox.sections = [
        { name: "description", height: 130, map_to: "text", type: "textarea", focus: true },
        { name: "location", height: 43, map_to: "details", type: "textarea" },
        //{ name: "Tags", height: 30, map_to: "Tags", type: "textarea" },
        { name: "time", height: 72, map_to: "auto", type: "time" }
        ]

        scheduler.locale.labels.section_location = "Meeting Room";
        //scheduler.locale.labels.section_Tags = "Tags";
        scheduler.locale.labels.section_description = "Meeting Title";

        scheduler.config.details_on_create = true;
        scheduler.config.details_on_dblclick = true;

        scheduler.init('scheduler_here', null, "month");

        dp = new dataProcessor("SchedulerConnector.ashx");

        scheduler.load("SchedulerConnector.ashx"+"?uid="+ scheduler.uid);
        var dp = new dataProcessor("SchedulerConnector.ashx"+"?uid="+scheduler.uid());

        dp.init(scheduler);
    }
    </script>
    <table class="style1" align="center">
        <tr>
            <td class="style49">
                
                <asp:LinkButton ID="HomeLinkButton" 
                                    runat="server" 
                                    onclick="HomeLinkButton_Click" 
                                    CssClass="style14">Home</asp:LinkButton>
            </td>
            <td class="style37">
                
                <asp:Label ID="DataReviewLabel" 
                            runat="server" 
                            Text="Data Review Room"></asp:Label>
                </td>
            <td class="style16" style="color: #0099FF">
                <strong>
                
                <asp:Label ID="VizLabel" 
                            runat="server" 
                            Text="Viz Room" 
                            CssClass="style11"></asp:Label>
                </strong>
                </td>
            <td class="style40">
                <asp:Label ID="RtoLabel" 
                            runat="server" 
                            Text="RTO Room"></asp:Label>
                </td>
            <td class="style35">
                <asp:Label ID="CollaborationLabel" 
                            runat="server" 
                            Text="Collaboration Room"></asp:Label>
                </td>
            <td class="style51">
                </td>
            <td class="style47">
                <asp:Button ID="LogOutButton" runat="server" onclick="LogOutButton_Click" 
                    style="height: 26px" Text="Log Out" />
            </td>
        </tr>
        <tr>
            <td class="style50">
                &nbsp;</td>
            <td class="style2">
                
                <asp:ImageButton ID="DataReviewImageButton" 
                                    runat="server" 
                                    Height="100px" 
                                    ImageUrl="~/Images/datareview.JPG" 
                                    Width="140px" 
                                    onclick="DataReviewImageButton_Click"/>
            </td>
            <td class="style41">
                <asp:Image ID="VizImage" 
                                    runat="server" 
                                    Height="100px" 
                                    ImageUrl="~/Images/viz.JPG" 
                                    Width="190px" />
            </td>
            <td class="style36">
                <asp:ImageButton ID="RtoImageButton" 
                                    runat="server" 
                                    Height="100px" 
                                    ImageUrl="~/Images/rto.JPG" 
                                    Width="140px" 
                                    onclick="RtoImageButton_Click" />
            </td>
            <td class="style39">
                <asp:ImageButton ID="CollaborationImageButton" 
                                    runat="server" 
                                    Height="100px" 
                                    ImageUrl="~/Images/collaboration.JPG" 
                                    Width="140px" 
                                    onclick="CollaborationImageButton_Click"/>
            </td>
            <td class="style51">
                &nbsp;</td>
            <td class="style47">
                &nbsp;</td>
        </tr>
        </table>

</div>
</form>
<div id="scheduler_here" class="dhx_cal_container" 
    style='border: thin dotted #000066; width:80%; height:80%; left: 125px;'>
    <div class="dhx_cal_navline">

    <div class="dhx_cal_prev_button">&nbsp;</div>
    <div class="dhx_cal_next_button">&nbsp;</div>
    <div class="dhx_cal_today_button"></div>
    <div class="dhx_cal_date"></div>
    <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
    <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
    <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>

    </div>
    <div class="dhx_cal_header">
    </div>
    <div class="dhx_cal_data">
    </div>
</div>

Somebody please help me…I don’t know where i’m wrong… :cry:

Hi,
i’ve just tested your code, there is nothing wrong with it,
maybe there is something wrong with Events table in db,
make sure that Id column is identity, and other columns allow nulls

Hi,

I already did what u have asked. but, it still doesn’t work. I’m afraid that my generic handler itself doesn’t want to working. Do you have any other solution to call my database?

check what server returns after saving event,
maybe there is server error or dhtmlxConnector error, it should give a clue

Hi,
it doesn’t returns any error after i click the button ‘save’ in the form. Seriously, i can do booking smoothly but, after i refresh the page that event is gone and when i check in my DB the details of the event is not there. I don’t how to check because after saving the event, it doesn’t give me any notice or error. Except for my .aspx there something that underlined with green. is that affected? (attachment).


your code is ok, i’ve copy-pasted it into new project, created database and it worked - saving and loading. the only things that may differ - our database settings and scheduler codebase.

One thing that i thought
try to remove the next line from .aspx

[code]

[/code] - all needed scripts should be already included into dhtmlxscheduler.js

Hi Aliaksandr,

Thank you so much! Now it saved into my database. and of course there is still have some parts need to be improved in my project. Anyway, thanks and i would like to know in easy way to understand what actually the problem with that line of code…?

dhtmlxscheduler.js already includes code of connector.js, so when you are including this file on page - the same logic activated second time, which may lead to code conflicts