2

very standard code

 using (Ajax.BeginForm("Search", "Subscriber", null, 
                        new AjaxOptions 
                                 { 
                                  OnBegin   = "ajaxBegin", 
                                  OnFailure = "ajaxFailure", 
                                  OnSuccess = "ajaxSuccess" 
                                 },
                                 new{id = "ajax1121"})
                       {
                       }

its output <form action="" ...> action is empty !! I tried changing the code with another overload by removing ajaxoptions etc, no use

and most amazing, same code works at another area. I even tried copying _ViewStart.cshtml and Web.config files from the area to problem area, still not working. The area got problem name Mail

Any ideas?

1 Answer 1

5

Yes, no client side. Instead of putting your Controller name, put in Route object

using (Ajax.BeginForm("Search", new { Controller = "Subscriber", area = "area name here"}, null, new AjaxOptions { OnBegin = "ajaxBegin", OnFailure = "ajaxFailure", OnSuccess = "ajaxSuccess" },new{id = "ajax1121"}){
}
3
  • Ajax.BeginForm("Search", new { Controller = "Subscriber", Area = "Mail"}, new AjaxOptions.. still output <form action="" ... :(
    – Eric Yin
    Apr 23, 2012 at 18:06
  • Hmmmm, do you have a route registered for your area?
    – bobek
    Apr 23, 2012 at 18:07
  • ohh, yes. Because I changed the default route, the one with id = UrlParameter.Optional and {controller}/{action}/{id}. Now I put it back now everything is working. Thanks
    – Eric Yin
    Apr 23, 2012 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.