search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

help again

Asked by Anonymous
17 years ago.

Hi Dan,

Thank you for answering to my earlier questions all

Help again:
1) Events not displaying when change the calendar date (if the control inside the table cell). Please refer below working and not working function for your reference. We are aligning the control in vertically hence using table.
2) Is it possible to increase the cell height if got event?
3) Not resizing when resize the event

private void working()
{
Session["sesUserId"] = "fsafs";
string sUserID = Session["sesUserId"].ToString();
string sQuery;
// Table table;
TableRow tr;
TableRow trl;
TableCell tc;
TableCell tclbl;
DayPilotCalendar dpc;
Label lbl;

//table = new Table();
//tblDayCal.EnableViewState = true;
//table.ID = "table";
tblDayCal.BorderStyle = BorderStyle.None;



//this.form1.Controls.Add(tblDayCal);
tr = new TableRow();
trl = new TableRow();
// Getting User calendar access
dsUserCal = ExcuteSQL(sQuery);

// Getting list of events date(s) by accessable user(s)
dsG = ExcuteSQL(sQuery);

GetUserEvents(sUserID, DayPilotCalendar1);

tc = new TableCell();
tclbl = new TableCell();
lbl = new Label();

lbl.Font.Bold = true;
lbl.ForeColor = Color.Green;
lbl.EnableViewState = true;
lbl.ID = "lbCalendar" ;
lbl.Text = "Please select a day";

tclbl.BackColor = Color.YellowGreen;
//tclbl.Controls.Add(lbl);

tc.VerticalAlign = VerticalAlign.Top;
//tc.Controls.Add(Calendar1);
trl.Cells.Add(tclbl);
tr.Cells.Add(tc);


tc = new TableCell();
tclbl = new TableCell();
lbl = new Label();

lbl.Font.Bold = true;
lbl.EnableViewState = true;
lbl.ID = "lbRootCal";
lbl.Text = "Root User";

tclbl.BackColor = Color.YellowGreen;
tclbl.Controls.Add(lbl);

//tc.Controls.Add(DayPilotCalendar1);
trl.Cells.Add(tclbl);
tr.Cells.Add(tc);
foreach (DataRow dr in dsUserCal.Tables[0].Rows)
{

//tc = new TableCell();
//tclbl = new TableCell();

dpc = new DayPilot.Web.Ui.DayPilotCalendar();

dpc.Width = 500;
dpc.ID = "dpc" + dr["CalUserId"].ToString();
dpc.EventEditHandling = DayPilot.Web.Ui.Enums.UserActionHandling.JavaScript;
this.form1.Controls.Add(dpc);
GetUserEvents(dr["CalUserId"].ToString(), dpc);

lbl = new Label();

lbl.Font.Bold = true;
tclbl.BackColor = Color.YellowGreen;
lbl.EnableViewState = true;
lbl.ID = "Label" + dr["CalUserId"].ToString();
lbl.Text = dr["UserName"].ToString();

//tclbl.Controls.Add(lbl);
//tc.Controls.Add(dpc);
//trl.Cells.Add(tclbl);
//tr.Cells.Add(tc);
}
//tblDayCal.Rows.Add(trl);
//tblDayCal.Rows.Add(tr);

}

private void NotWorking()
{
Session["sesUserId"] = "fsafs";
string sUserID = Session["sesUserId"].ToString();
string sQuery;
Table tblDayCal;
TableRow tr;
TableRow trl;
TableCell tc;
TableCell tclbl;
DayPilotCalendar dpc;
Label lbl;

tblDayCal = new Table();
//tblDayCal.EnableViewState = true; (true/false both are not working)
//table.ID = "table";
tblDayCal.BorderStyle = BorderStyle.None;



this.form1.Controls.Add(tblDayCal);
tr = new TableRow();
trl = new TableRow();
// Getting User calendar access
dsUserCal = ExcuteSQL(sQuery);

// Getting list of events date(s) by accessable user(s)
dsG = ExcuteSQL(sQuery);

GetUserEvents(sUserID, DayPilotCalendar1);

tc = new TableCell();
tclbl = new TableCell();
lbl = new Label();

lbl.Font.Bold = true;
lbl.ForeColor = Color.Green;
lbl.EnableViewState = true;
lbl.ID = "lbCalendar";
lbl.Text = "Please select a day";

tclbl.BackColor = Color.YellowGreen;
tclbl.Controls.Add(lbl);

tc.VerticalAlign = VerticalAlign.Top;
tc.Controls.Add(Calendar1);
trl.Cells.Add(tclbl);
tr.Cells.Add(tc);


tc = new TableCell();
tclbl = new TableCell();
lbl = new Label();

lbl.Font.Bold = true;
lbl.EnableViewState = true;
lbl.ID = "lbRootCal";
lbl.Text = "Root User";

tclbl.BackColor = Color.YellowGreen;
tclbl.Controls.Add(lbl);

tc.Controls.Add(DayPilotCalendar1);
trl.Cells.Add(tclbl);
tr.Cells.Add(tc);
foreach (DataRow dr in dsUserCal.Tables[0].Rows)
{

tc = new TableCell();
tclbl = new TableCell();

dpc = new DayPilot.Web.Ui.DayPilotCalendar();

dpc.Width = 500;
dpc.ID = "dpc" + dr["CalUserId"].ToString();
dpc.EventEditHandling = DayPilot.Web.Ui.Enums.UserActionHandling.JavaScript;
this.form1.Controls.Add(dpc);
GetUserEvents(dr["CalUserId"].ToString(), dpc);

lbl = new Label();

lbl.Font.Bold = true;
tclbl.BackColor = Color.YellowGreen;
lbl.EnableViewState = true;
lbl.ID = "Label" + dr["CalUserId"].ToString();
lbl.Text = dr["UserName"].ToString();

tclbl.Controls.Add(lbl);
tc.Controls.Add(dpc);
trl.Cells.Add(tclbl);
tr.Cells.Add(tc);
}
tblDayCal.Rows.Add(trl);
tblDayCal.Rows.Add(tr);

}

Comment posted by Anonymous
17 years ago.

the function calls like below

protected void Page_Load(object sender, EventArgs e)
{
//AddCalendar();
working();
//this.Calendar1.SelectedDate = System.DateTime.Now;
if (!IsPostBack)
{
Calendar1.VisibleDate = DateTime.Today;
Calendar1.SelectedDate = DateTime.Today;
DataBind();
}

}

Comment posted by Anonymous
17 years ago.

i fixed issue 1.

can you please explain 2 and 3?

Comment posted by Dan Letecky
17 years ago.
Hi, Sorry for the delay.

2. Cell height can be only changed for all cells (using CellHeight property).
3. You need to set EventResizeHandling to CallBack or PostBack and handle EventResize event (check also http://www.daypilot.org/event-resizing.html).

Let me know if it's still not working.
Comment posted by Anonymous
17 years ago.

Thanks Dan.

Hi,
Still no luck
The code as follows:
protected void DPC_EventResize(object sender, DayPilot.Web.Ui.Events.EventResizeEventArgs e)
{
DayPilotCalendar d = sender as DayPilotCalendar;
if (null != d)
{
DataSet dsEvent = (DataSet)d.DataSource;
d.DataSource = dsEvent;
d.DataBind();
d.Update();
}
}

And I am assigning the property while creating the dynamic object:

dpc.EventResizeHandling = DayPilot.Web.Ui.Enums.UserActionHandling.CallBack;
dpc.EventResize += new EventResizeEventHandler(DPC_EventResize);

however its still not resizing when try to resize the events.

I am not updating the any DB side only resize the events only.

Comment posted by Dan Letecky
17 years ago.
In the event handler, you need to supply an updated DataSource and call DayPilotCalendar.DataBind() and DayPilotCalendar.Update().

In the code you posted, the value of DayPilotCalendar.DataSource will be null unless you have declared it explicitly in the ASPX declaration. For the testing purposes, you can store the data source in a Session (that's what's used in the examples). The typical application will however load it from a database again.

The scenario must be as follows:

1. Modify the data source (either in Session or in the DB).
2. Assign the updated data source to DayPilotCalendar.DataSource.
3. Call DayPilotCalendar.DataBind() and DayPilotCalendar.Update().
Comment posted by Vladimir
17 years ago.

Hi. I've got a similar problem. When i modify data like this

DayPilotCalendar1.DataSource = iDayPilotController.GetEventsData();
DayPilotCalendar1.DataBind();
DayPilotCalendar1.Update();

after NOT firing Day Pilot Event, Day Pilot Calendar doesn't redraw. As far as i can see during debug, render method is called, but nothing happens, tha data in a Day Pilot Calendar doesn't change.

Comment posted by Dan Letecky
17 years ago.
It's important to know when you are calling these methods. Can you post more about your scenario?

Generally, you can only update the data using one of the following mechanisms:
  • generic PostBack (generated by DayPilot or any other control),
  • internal CallBack (generated by DayPilot or by the client-side DayPilot methods), or
  • partial PostBack (when DayPilot is inside an UpdatePanel from ASP.NET AJAX library).
Comment posted by Vladimir
17 years ago.

My scenario - i updata data in database, then i updata DayPilotCalendar Data Source, bind data and call Update of the control. The Problem Is that the control doesn't redraw, because as far as i can see redraw method is called only in event handler(maybe i am mistaken, then correct me pleese). So the question is How i can call redraw of this control?

Comment posted by Vladimir
17 years ago.
ow.. i've forgotten to tell, that i'm calling this method by clicking a button. In a fact it doesn't matter. I just need to understand, why this control doesn't redraw in the way i need :(
Comment posted by Dan Letecky
17 years ago.
Can you please send your code to daypilot @ annpoint.com? That should be faster...
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.