12

Can anyone please tell what's the exact differences between partial views and user controls in an MVC app? Which one is feasible to use? I am using user controls for filling my views which have one or more tabs(which i have added using Ajax control toolkit). I want to know about advantages/disadvantages while using partial views and user controls.

Thanks, Kaps

2 Answers 2

16

I mostly agree with Ryan. However one point to consider though is that user controls have an implementation of events whereas partial views do not.

Kindness,

Dan

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

2 Comments

What you said is one of the most important difference between them. Thanks for reminding that also.
in asp.net mvc is there any concept about event. if we work with user control then can we implement like event driven programming?
9

Partial Views and User Controls are basically the same thing. User Controls are just a way of distinguishing between regular Views and Partials. When you see the "Partial.ascx", it's immediately obvious that it's a Partial because the icon is different in Visual Studio.

There's nothing stopping you from using a regular *.aspx file as a Partial. In fact, some people do exactly this, and prefix their aspx Partial names with an underscore (ex: _UserStatus.aspx).

My personal preference is to use the ascx files instead because it's easier to tell that something is a partial at a glance.

Comments

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.