开发者

AjaxControlToolkit ModalPopup in Asp.net MVC

I have a DashBoard view. On clicking on Assign button a ModalPopup Opens like :

AjaxControlToolkit ModalPopup in Asp.net MVC

Code for opening PopUp

开发者_如何学Go
$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
}


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.


This worked for me

$.ajax ({ type: "POST", url: "/Home/SaveEntry", data: { "savedata": data }, success: successFunction, error: errorFunction }); `

function successFunction() { 
    alert('Inserted in Table successfully');
}

function errorFunction(){
    alert('Some error occurred');
}

` 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); }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜