My solution was not perfect. I still cannot seem to refresh the data that is being used in the calendar. I tried to call a custom method that calls the SQL from the refresh method, but it never works. Is there a good way to pass the new data that comes from the javascript.dc1.refreshcallback method into a place where I can then run my custom SQL to bring back the new data for the new dates.
protected void datab(String ndate){
Response.Write(ndate);
m= Request.Form["month"];
y= Request.Form["year"];
RadioGroup1a = Request.Form["RadioGroup1a"];
typ= Request.Form["type"];
department = Request.Form["department"];
ctype = Request.Form["ctype"];
if(m != null){
if( RadioGroup1a == "resolved") {
addstuff = addstuff + " AND ( resolved = 1 )";
}
if( RadioGroup1a == "unresolved") {
addstuff = addstuff + " AND ( resolved = 0 )";
}
if(typ != null){
typ = Regex.Replace(typ, "'","*");
}
if( typ == "4" ) {
addstuff = addstuff;
}else{
addstuff = addstuff +" And a1actor = " + typ + " ";
}
if( department == "18" ) {
}else{
addstuff = addstuff + " And csusers.department = " + department + " ";
}
if( ctype == "All" ) {
}else{
addstuff = addstuff + " And citystat.ctype = '" + ctype + "' ";
}
}
// Response.Write("XXXXXXXXXXXXX" + m);
if(m == null){
m = "current";
y = "current";
}
DateTime dtVariable = DateTime.Now;
if(m == "current"){ mx= (dtVariable.Month); }
if(y == "current"){ yx= (dtVariable.Year); }
dx= (dtVariable.Day);
dex = dx + 7;
//
dbstring = mx +"/" + 1 + "/" + yx;
if(mx == 12){ mx = 1; yx = yx +1;}else{ mx = mx + 1;}
destring = mx +"/" + 1 + "/" + yx;
// Convert.ToDateTime(mx +"/" + dx + "/" + yx);
// Response.Write("XXXXXXXXXXXXX" + m);
//
DataTable dt;
dt= new DataTable();
Response.Write( "SELECT citystat.id, [ctype], [A1begin], [A1date], [allday] FROM [citystat] INNER JOIN csusers ON citystat.a1actor = CSusers.id INNER JOIN CSdepartments ON csusers.department = CSdepartments.id WHERE [A1date] <= '" + destring + "' AND [A1begin] >= '" + dbstring + "' " + addstuff + " ");
// Response.End();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["daypilot"].ConnectionString))
{
con.Open();
SqlDataAdapter ad = new SqlDataAdapter("SELECT citystat.id, [ctype], [A1begin], [A1date], [allday] FROM [citystat] INNER JOIN csusers ON citystat.a1actor = CSusers.id INNER JOIN CSdepartments ON csusers.department = CSdepartments.id WHERE [A1date] <= '" + destring + "' AND [A1begin] >= '" + dbstring + "' " + addstuff + " ", con);
DataSet ds = new DataSet();
ad.Fill(ds,"Categories");
DayPilotCalendar1.StartDate = Convert.ToDateTime(dtVariable);
DayPilotCalendar1.DataSource = ds;
}
}