开发者

jqgrid onselected row redirect url not working on server (MVC3)

开发者 https://www.devze.com 2023-02-26 22:05 出处:网络
i am having a problem with jqgrid onselected row event and document.location.href in MVC.. i have this code in my jqgrid:

i am having a problem with jqgrid onselected row event and document.location.href in MVC..

i have this code in my jqgrid:

onSelectRow: function (id) {
                    document.location.href ="/Search/Details/" + id;
                },

on selecting a row it will redirect to another view..its working fine on my machine..

whenever i pushed to server its not working there and its throwing page not found error..

can i use @Url.Content or some thing which resolves my url..or is there any server setting i need to look at... please help me...thanks a lot...

UPDATE & Answer: finally i found it..if we want to use @Url.Content check the following code..its working fine...

onSelectRow: function (id) {
   开发者_如何学Go                 document.location.href ='@Url.Content("/Search/Details/")' + id;
                },

Thanks a lot..


Try setting the location.pathname instead, since that is the relative path.

onSelectRow: function(id) {
    window.location.pathname = "/Search/Details/" + id;
},
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号