传递FullCalendar日期到我的对话框模式窗体 [英] Passing FullCalendar date to my dialog box modal form
问题描述
我使用fullcalendar什么,我想的是,日点击传递给一个对话框模式窗体(asp.net的MVC PartialView)。这是我的code现在:
I'm using fullcalendar and what I want is that the date clicked be passed to a dialog box modal form(asp.net mvc PartialView). This is my code right now:
$calendar.fullCalendar({
events: "/Home/CalendarData",
dayClick: function (date) {
$calendar.fullCalendar("renderEvent", { title: "on process", start: date}, true);
$("#editDialog").html('')
.load("/Home/About", function () {
$("#editDialog").data("value", date).dialog("open");
});
}
});
正如你看到我已经尝试过使用数据()函数的值传递给我的对话框。有没有我的PartialView访问数据的方式?
As you see i already tried passing a value to my dialog using data() function. Is there a way for my PartialView to access that data?
推荐答案
您应该能够通过使用第二个参数一个JSON有效载荷的$ .load
You should be able to pass a json payload using the second parameter of the $.load
例如:
$calendar.fullCalendar({
events: "/Home/CalendarData",
dayClick: function (date) {
$calendar.fullCalendar("renderEvent", { title: "on process", start: date}, true);
var payLoad = {
‘selectedDate’ : date
};
$("#editDialog").html('')
.load("/Home/About", payLoad, function () {
$("#editDialog").data("value", date).dialog("open");
});
}
});
在上面的例子中,我们正在创造的有效载荷的名字JSON对象并在通过$ .load方法传递给它。现在,您可以通过名称 selectedDate 在控制器动作定义一个变量,并捕获值
In the above example, we are creating a json object by the name of payLoad and passing it in via $.load method. Now you can define a variable by the name selectedDate on your controller action and capture the value
这篇关于传递FullCalendar日期到我的对话框模式窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!