我有一个日历控件,它在Page_Load上填充了事件。当用户点击某个单元格时,我想在该单元格中找到事件,然后使用这些信息填充文本区域。
点击某个单元格时,我可以让Click事件发生,但我不知道如何获取该事件并在Javascript的文本区域中显示。
<DayPilot:DayPilotMonth CssClassPrefix="bsimplexcalender"
OnCommand="calender_control_Command"
ContextMenuID="menu"
EventRightClickHandling="ContextMenu"
EventRightClickJavaScript="select(e)"
BubbleID="DayPilotBubble1"
ClientObjectName="dpm"
runat="server"
ID="calender_control"
Theme="bsimplexcalender"
HeightSpec="Auto" Height="0"
MinCellHeight="63"
DataStartField="start"
DataEndField="end"
DataTextField="name"
DataValueField="id"
OnBeforeEventRender="calender_control_BeforeEventRender"
TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="''THIS IS THE CLICK EVENT I NEED TO FIND EVENT AND DISPLAY HERE" />
答案 0 :(得分:0)
此代码可能有所帮助:
适用于JavaScript:
function loadCalendarEvent(day) { //call this function when table cell is clicked
//in var day pass the day clicked
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//just received the answer from server so do something with it here
}
}
var url; //link to php file
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-Type", "text/json"); //change Content-Type to what you need
xmlhttp.send(day);
}
对于PHP:
<?php
$ClientData = file_get_contents('php://input'); //day variable is stored here
//query database for event and save it to some variable
echo $thatVariable;
?>
如果您想让我解释一下,请发表评论......