วันพฤหัสบดีที่ 23 พฤษภาคม พ.ศ. 2556

C# Ajax.ActionLink How to Add Onclick for confirm or validate.

I try to insert onclick or @onclick in html attribute but it don't work.
so I try research and found this

@Ajax.ActionLink("Done", "ActionName", 
    new AjaxOptions 
    { 
        OnBegin = "return ConfirmDone()", 
        UpdateTargetId = "MyContainerId" 
    })
@Ajax.ActionLink("Done", "ActionName", 
    new AjaxOptions 
    { 
        Confirm= "Are you sure you want to do this?", 
        UpdateTargetId = "MyContainerId" 
    })
With this i can add function validate on begin or add confirm before click from Ajax Option.

ref: http://stackoverflow.com/questions/9604942/asp-net-mvc3-ajax-actionlink-conditional-confirmation-dialog-box

ไม่มีความคิดเห็น: