Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
SQL Query
SharePoint Interview
general knowledge
 :) Hot Jobs
 :) Latest Articles


Different between MasterPages and UserControl
Classified Posted on 06 Mar 2019

Home >> DotNet >> ASP.NET >> Different between MasterPages and UserControl

Different between MasterPages and UserControl
Both of these provide a common design which is used in .aspx pages. We can pass data from both of this to .aspx pages and viceversa.

MasterPage:-(1)Files in master page have .Master extension which is comes in ASP.NET 2.0. It has code file master.cs or master.vb extension. And this can use all toolbox controls.
UserControl:-(1) This have .ascx extension. And code files are .aspx.cs or .ascx.vb. And this can use all toolbox controls.

MasterPage:-(2)This have a control name ContentPlaceHolder which have a storage location where we can put out contents of .aspx page. Common part for pages will be outside of ContentPlaceHolder. It can be increase or decrease as per our needs.
UserControl:-(2)This doesnot have any ContentPlaceHolder control so layout of this have some difficult in providing proper layout and alignment for large designs.

MasterPage:-(3)We need to add MasterPageFile attribute in the page directive of the .aspx page. The .aspxpage that uses the master page is known as content page.
UserControl:-(3)When we drag and drop a user control on page it is automatically Register and a Register Tag is added.

MasterPage:-(4)We can refernce using Web.Config file and we can do dynamically by writing code in preInit event.
UserControl:-(4)Can be attached dynamically using LoadControl method.

MasterPage:-(5)More suitable for large designs
UserControl:-(5)Suitable for small design

And one of main difference is thet we use UserControl in MasterPages. But MasterPages cannot be used in User Controls.

Other Important Questions
Colour coding in ListBox
Void Function return value with out parameter
What is Substitution control in asp.net 4.0
How to stop the clientside validation of an entire page
get session variable value in html page

Top Searches:asp net questions vb net questions sql query uddl questions class javascript sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |