Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Html.RenderAction to call the Get method on a Post?

After rendering a view on a Post, a call to RenderAction inside the view will call for the Post method. Is there any way to specify I want to call the Get method instead of the Post?

like image 822
godhandiscen Avatar asked Sep 21 '10 03:09

godhandiscen


People also ask

What is the difference between HTML action and HTML RenderAction?

The difference between the two is that Html. RenderAction will render the result directly to the Response (which is more efficient if the action returns a large amount of HTML) whereas Html. Action returns a string with the result.

What is the use of RenderAction in MVC?

RenderAction(HtmlHelper, String, String, Object)Invokes the specified child action method using the specified parameters and controller name and renders the result inline in the parent view.

How does HTML action work?

The HTML | action Attribute is used to specify where the formdata is to be sent to the server after submission of the form. It can be used in the <form> element. Attribute Values: URL: It is used to specify the URL of the document where the data to be sent after the submission of the form.

What is render action?

A render action is a public method on the controller class. You can define a render action method to return any data, but you can only safely use it if it returns an HTML markup string.


1 Answers

It's not a separate request happening, so it's going to use the existing request context. You may want to differentiate the action by its name, and use the ChildActionOnly attribute to mark that action as only being available via RenderAction

like image 154
Andrew Barber Avatar answered Nov 12 '22 09:11

Andrew Barber