0

Just I am learning MVC,(ofcourse i get enough information from MS Website).I want to quickly clarify some details.

1) What is the use of PartialView in MVC,Is it similar to partial update of Ajax? I am does the partialView modify the HTML DOM structure?

2)Can i use Response.Redirect() in MVC?

4 Answers 4

4

1) Partial View is more like a UserControl. Update Panels are not fully supported (in my eyes a good thing as they add a lot to page size). You can use them as such:

<div id="logindisplay">
                <% Html.RenderPartial("LogOnUserControl"); %>
            </div>

2) You can use Response.Redirect in MVC but you may prefer to use RedirectToAction as it will help with your routing if you ever come to change it

return RedirectToAction("Index", "Home");
Sign up to request clarification or add additional context in comments.

1 Comment

Also if you need to redirect to something other than an Action, you can simply return Redirect("mysite.com");.
0
  1. Dan is right, you can think of partial view as a "serverside" includes, its a pretty nice way to i.e include a login controller functionality, banner rotator. You can also make use of the view model for that particular view you are looking at. Take a look at i.e ui templates in mvc2 thats technicaly a partial view.

  2. yes you can, but you probably want to use RedirectToAction method instead.

Comments

0

Partial view is special view which renders a portion of view content. It is just like a user control web form application. Partial can be reusable in multiple views. It helps us to reduce code duplication. In other word a partial view enables us to render a view within the parent view

Comments

0
  1. Not really, a partial view is more a resuable bit of HTML.

  2. Yes, you can.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.