Rendering view in ASP.Net MVC?

Html. Partial actually returns the result of rendering the view, you want to do %= Html.Partial() % or % Html.RenderPartial(); %.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

In my code I am using a partial view (call it PV1) and in that partial view I am using "Ajax. BeginForm" to redirect it to a particular action, hence it is doing so ... using (Ajax. BeginForm("action1", "Forms", null, new AjaxOptions { UpdateTargetId = "div_1" }, new { id = "form1" })) { Response.

Write("I am here. "); } public ActionResult action1(XYZ Model) { // return PartialView("PV1", Model); } at the last line of action I am again calling the same partial 'PV1', hence it is doing this too ... but when rendering the view it don't print or do the steps written with in partial view, it override them with and show nothing ... asp.net asp.net-mvc partial-views link|improve this question edited Apr 20 '11 at 16:25Bala R38.3k52958 asked Apr 20 '11 at 16:24Safran Ali1,7821322 95% accept rate.

Html. Partial actually returns the result of rendering the view, you want to do or Html.Partial() returns the Html and thusly must be output on the page via and Html.RenderPartial() uses Response. Write to output onto the page and can be used with .

I am using Html.Partial(), as I am returning the output result from controller action to a view ... but does it make any difference to my query what I am using to render the output ... and just to let you know ... tried both method ... but problems still exist ... pls provide me with an example ... – Safran Ali Apr 26 '11 at 13:58 I did it using Html.RenderPartial() ... but doing so you have to be very careful arranging your divs ... – Safran Ali May 18 '11 at 11:04.

This is not what you would use Ajax. BeginForm for. That helper is used to create actual tags that will later be submitted to the server using MVC's unobtrusive ajax (so you still need some kind of a trigger action - a button, javascript - anything that submits the form).

I'm am not very clear on what you're trying to achieve. If you want to load a partial view with ajax, I would suggest using something like jQuery's ajax load method.

I am using a submit button ... but again instead rendering the partial view with in page it displays the partial view in blank page ... I also tried to used InsertionMode with Ajax. BeginForm ( ... ) and ... I am trying to achieve same result as it is explained in following post stackoverflow.com/questions/931001/… but the result is same ... and can you pls also help me show how to achieve the same behaviour using jquery & ajax (pls give some code example ...) – Safran Ali Apr 26 '11 at 13:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions