Asp.net MVC 中的 AjaxControlToolkit ModalPopup
我有一个 DashBoard
视图。 单击 Assign
按钮时,ModalPopup 将打开,如下所示:
用于打开 PopUp 的代码
$create(AjaxControlToolkit.ModalPopupBehavior,
{
"BackgroundCssClass": "modalBackground",
"DropShadow": false,
"OkControlID":
"OkButton",
"OnOkScript": "onOk()",
"PopupControlID": "div_to_popup",
"id": "PopUpBox"
}, null, null, $get("day"+a));
function onOk(){
// what to write here to save data on server
}
I have a DashBoard
view.
On clicking on Assign
button a ModalPopup Opens like :
Code for opening PopUp
$create(AjaxControlToolkit.ModalPopupBehavior,
{
"BackgroundCssClass": "modalBackground",
"DropShadow": false,
"OkControlID":
"OkButton",
"OnOkScript": "onOk()",
"PopupControlID": "div_to_popup",
"id": "PopUpBox"
}, null, null, $get("day"+a));
function onOk(){
// what to write here to save data on server
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 jQuery 您选择的插件。
我建议完全不要将 Ajax Control Toolkit 与 ASP.NET MVC 一起使用,因为它既古老又有点老套,而且(更重要的是)主要针对 WebForms 开发。
You could probably do this with a jQuery plugin of your choice.
I would advise against using the Ajax Control Toolkit with ASP.NET MVC at all, since it is both old and kind of hacky to begin with, and (more importantly) heavily targeted against WebForms development.
这对我有用
$.ajax
({
类型:“帖子”,
url: "/Home/SaveEntry",
数据:{“savedata”:数据},
成功:成功函数,
错误:错误函数
});
`
<代码>
`
我的控制器
public void SaveEntry(string savedata)
{
string[] temp = result.Split('|');
GS_ALLOCATION 移位 = 新 GS_ALLOCATION();
shift.EMP_CODE = 小数.Parse(temp[0]);
shift.ALLOC_DATE = DateTime.Parse(temp[2]);
shift.TEAM_CODE = temp[3];
shift.WWL_WEEK = 临时[4];
shiftRepo.AddShift(shift);
}
This worked for me
$.ajax
({
type: "POST",
url: "/Home/SaveEntry",
data: { "savedata": data },
success: successFunction,
error: errorFunction
});
`
`
My Controller
public void SaveEntry(string savedata)
{
string[] temp = result.Split('|');
GS_ALLOCATION shift = new GS_ALLOCATION();
shift.EMP_CODE = decimal.Parse(temp[0]);
shift.ALLOC_DATE = DateTime.Parse(temp[2]);
shift.TEAM_CODE = temp[3];
shift.WWL_WEEK = temp[4];
shiftRepo.AddShift(shift);
}