.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

Different Between User Control and Custom Control

Posted By :Sagar Pardeshi     Posted Date :September 28, 2013    Points :40   Category :.NET Framework 
User Control

Reusability Web page
We can't add to toolbox
Good for static layout
Not compiled DLL

Reusability of control
We can add toolbox
Good dynamics layout
Not compiled DLL

You can also find related Interview Question to Different Between User Control and Custom Control  below: 

What is different between Web User Control and in Web Custom Control?

Web user controls : Web User Control is Easier to create and another thing is that its support is limited for users who use a visual design tool one gud thing is that its contains static layout one more thing a seprate copy is required for each application.

Web custom controls: Web Custom Control is typical to create and gud for dynamic layout and another thing is it have full tool support for user and a single copy of control is required because it is placed in Global Assembly cache. (More...)

Difference Between User Control and Custom Control In Asp.Net?

User Controls: We need to implement with Predefined Functionality with Available Properties

Web User Controls:Web User Controls Implements Customized Properties and Customized Methods,we can develop any control with User defined Properties


What is the difference between Custom Control and User Control

Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls.

Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.

User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files. (More...)

What is a user control?

An ASP.NET user control is a group of one or more server controls or static HTML elements that encapsulate a piece of functionality. A user control could simply be an extension of the functionality of an existing server control(s) (such as an image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist of several elements that work and interact together to get a job done (such as several controls grouped together that gather information about a user's previous work experience). (More...)

How can we register a custom server control to a web page ?

we can register a custom server control to a web page using

@Register directive (More...)

How to use a user control in a Web Forms page

Declare the @ Register directive.

For example, use the following code.
<%@ Register TagPrefix="UC" TagName="TestControl" Src="test.ascx" %>

How to create an instance of a user control programmatically in the code behind file of a Web Forms page

Create a new Web Forms page in Visual Studio.
Navigate to the code behind file generated for this Web Forms page.
In the Page_Load event of the Page class, write the following code.
// Load the control by calling LoadControl on the page class.
Control c1 = LoadControl("test.ascx");

// Add the loaded control in the page controls collection.


How a user control is processed

When a page with a user control is requested, the following occurs:

1)The page parser parses the .ascx file specified in the Src attribute in the @ Register directive and generates a class that derives from the System.Web.UI.UserControl class.

2)The parser then dynamically compiles the class into an assembly.
If you are using Visual Studio, then at design time only, Visual Studio creates a code behind file for the user control, and the file is precompiled by the designer itself.

3)Finally, the class for the user control, which is generated through the process of dynamic code generation and compilation, includes the code for the code behind file (.ascx.cs) as well as the code written inside the .ascx file.

What are Events fired for User Control in ASP.NET ?

The Sequence of User controls Execution as follows.

OnInit of the user control
OnInit of the containing page
OnLoad of the containing page
OnLoad of the user control (More...)

How do you deploy a User Control in SharePoint ?


Ans. You deploy your User Control either by a Custom webpart, which will simply load the control on the page or can use tools like SmartPart, which is again a webpart to load user control on the page. User Control can be deployed using a custom solution package for the webapplication or you can also the control in the webpart solution package so that it gets deployed in _controlstemplate folder (More...)

Which is faster a WebPart or a User Control?

Ans. A WebPart renders faster than a User Control. A User Control in SharePoint is usually loaded by a webpart which adds an overhead. User Controls however, gives you an Interface to add controls and styles. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend