วันพุธที่ 5 มิถุนายน พ.ศ. 2556

Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.



[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
   Mot_Inspector_Report.Filters.SimpleMembershipInitializer..ctor() +260
 
This error can happen when u try to publish .NET MVC (asp.net 4.00)
because u use Entity Framework 5 with .NET 4.0 instead of 4.5   

simple to fix this is uninstall Entity Framework 5 and re Install it.

use library package manager to do this

and after that may be u found this because u update plugin with "library package manager"

The "EnsureBindingRedirects" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies)
   at Roxel.BuildTasks.EnsureBindingRedirects.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()    Mot_Inspector_Report
 

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