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.
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']
}
精彩评论