2

lets say I want to a partial view like the following sample

@Html.RenderAction("ListDocuments", "MultiFileAttachments", new { id = jsparameter }); 

in the jsparameter I want to pass as a parameter that is the result of a javascript function. Maybe this is not logical because javascript runs on the client, but how can I achieve a similar functionality ? thank you in advance

1 Answer 1

1

If you need to call a part of a page based on some actions or values determined by actions on the client side, then you should think to use JavaScript (preferably jQuery) and Ajax.

Through jQuery-Ajax, you could easily call a Partial view through the Contoler and since it's a regular HTTP request, you would be able to pass all the parameters you need.

Using code as :

@Html.RenderAction("ListDocuments", "MultiFileAttachments", new { id = jsparameter });

is not possible since it is rendered by the server before it's sent to the client browser.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, it is necessary to pass the javascript value like this, because the value comes from the selection of a row (from a kendo grid) by the user. I just wanted to make sure there is no other way to achieve this other than jQuery. Thank you for the answer...

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.