views:

57

answers:

3

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?

A: 

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

2.) Yes, you can

Kindness,

Dan

Daniel Elliott
+4  A: 

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");
ArtificialGold
Also if you need to redirect to something other than an Action, you can simply return Redirect("http://mysite.com");.
mxmissile
A: 
  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.

cjensen