0

I am migrating from MVC2 to MVC4 and I have a problem when I use the Url.Action function whith params from jquery. The generated url is wrong. Im using C# with Framework 4.5.1 This is my code:

            var doc = jQuery('#grilla').jqGrid('getCell', row_id, 'Doc');
            var tipoDoc = jQuery('#grilla').jqGrid('getCell', row_id, 'TipoDoc');
            var idA = jQuery('#grilla').jqGrid('getCell', row_id, 'A');


            var subGrilla = jQuery("#" + subgrid_table_id).jqGrid({
                url: '<%= Url.Action("ObDCob", "ListCob",new { area = "Cob", xsDoc = "'+doc+'",xsTipoDoc = "'+tipoDoc+'",xiA = "'+idA+'"}) %>',

When the HTML is generated, the following is generated:

'/clearing/WebBP/Cob/ListCob/ObDCob/'%2bdoc%2b'/'%2btipoDoc%2b'/'%2bidA%2b''

Instead:

'/clearing/WebBP/Cob/ListCob/ObDCob/doc/tipoDoc/idA'

Any solution for this? Thanks

1 Answer 1

2

In MVC 4 use @ instead of <%= for Url.Action()

 url: '@Url.Action("ObDCob", "ListCob",new { area = "Cob", xsDoc = "'+doc+'",xsTipoDoc = "'+tipoDoc+'",xiA = "'+idA+'"})' 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.