แสดงบทความที่มีป้ายกำกับ Ajax แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Ajax แสดงบทความทั้งหมด

วันพฤหัสบดีที่ 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

วันจันทร์ที่ 19 มีนาคม พ.ศ. 2555

MVC Jquery Json return internal 500

When use getJSON and call Action result correct but response internal 500

This is because json not allow get type (Only post can do.)
fix this is simple by

return this.Json( list, JsonRequestBehavior.AllowGet );

The key is AllowGet for can call function simple.

วันพุธที่ 7 เมษายน พ.ศ. 2553

VevoCart 4 and Ajax Error in Admin page.

With this javascript error.

"Ajax client-side framework failed to load" and "Type is not defined"

However in Front page have no problem so I check on Admin page source and found this line in Default.aspx (rememver i cannot insert any tag here.)

asp:ScriptReference Name="MicrosoftAjax.js" Path="../ClientScripts/MicrosoftAjaxCustom/MicrosoftAjax.js"

but in source code they use this

script src="../ClientScripts/MicrosoftAjaxCustom/MicrosoftAjax.en-US.js" type="text/javascript"

Yes they have add Culture to path we reference so it can't find correct javascript

for setting in web.config compilation debug="true"

This will use ClientScripts\MicrosoftAjaxCustom\MicrosoftAjax.debug.js

and if compilation debug="false"

They will use ClientScripts\MicrosoftAjaxCustom\MicrosoftAjax.js

This happend in some server depend on server setting. not anyone found this
but finally I found solution for this

copy old script and place with culture in end of file name get rid of this error.
( Keep old file for compatible on any server that they don't add culture to script name )

Note * we use custome script to fix chrome loading issue but this only work with debug="true" if set false it will failed on load in Admin Some page.