0

I'm developing my first ASP.NET MVC 3 application and have a couple of jqGrid grids on some of my pages. I noticed that I get a 404 error for some dataUrls on the server that work fine when I'm running on the built-in server in Visual Studio locally.

Locally my site runs on something like http://localhost:57000/IceCream but it is deployed to something like http://10.10.5.100/IceCreamShop/IceCream.

I'm specifying my searchoptions like so:

searchoptions: {
   dataUrl: '/IceCream/AvailableToppings',
   buildSelect: createSelectList,
   sopt: ['eq']
}

Notice - no IceCreamShop listed in the route.

Perhaps I'm just going about this the wrong way. How do I specify the route correctly so it runs in either environment?


SOLVED

All I needed to do was this:

searchoptions: {
   dataUrl: '@Url.Action("AvailableToppings", "IceCream")',
   buildSelect: createSelectList,
   sopt: ['eq']
}

Easy enough. Nothing to see here... move along... move along.

itsmatt
  • 31,265
  • 10
  • 100
  • 164
  • Look at [the answer](http://stackoverflow.com/questions/2819044/post-ajax-call-results-in-not-found-using-jqgrid-and-asp-net-mvc-2-on-iis6/2820725#2820725) where I described how I solve the same problem in my projects. – Oleg Aug 10 '11 at 18:38

1 Answers1

0

As I wrote in my update to the question, all I needed to do was this:

searchoptions: {
   dataUrl: '@Url.Action("AvailableToppings", "IceCream")',
   buildSelect: createSelectList,
   sopt: ['eq']
}
itsmatt
  • 31,265
  • 10
  • 100
  • 164