For training related to .net,OOPS,design patterns, MVC,WCF and .net fundamentals
contact at or Click Here

Click here for my training feedbacks


Follow Us

Share your Interview questions here

For software development queries contact

Follow by Email

Learn everything about JSON in a day

20 December 2010 User Control Vs Custom Control

Development and Deployment:-
User control:-
  • Basically Designed For a single application.
  • Deployed in the source form (.ascx) along with the source code of the application.
  • If the same control needs to be used in more than one application, it introduces redundancy and maintenance problems.

Custom control:-
  • Designed so that it can be used by more than one application.
  • Deployed either in the application's Bin directory or in the global assembly cache.
  • Distributed easily and without problems associated with redundancy and maintenance.

User control:-
  • Creation is similar to the way Web Forms pages are created; well-suited for rapid application development (RAD).
  • Much better in cases where static contents are more than logic.

Custom control:-
  • There is no direct UI availabe at Design time,so lots of code required.
  • Better when we have more logic compare to content or we can say when requires dynamic contents to be displayed.

const vs. readonly

  • A constant member is defined at compile time and cannot be changed at runtime. 
  • Constants are declared as a field, using the const keyword and must be initialized as they are declared.
  • Constants must be a value type (sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, orbool), an enumeration, a string literal, or a reference to null.(Since classes or structures are initialized at run time with the new keyword, and not at compile time, you can't set a constant to a class or structure.).
  •  It cant be static.
public class MyClass { public const double PI = 3.14159; }


  • A read only member is like a constant in that it represents an unchanging value.
  • They are declared as a field, using the readonly keyword and can be initialized at runtime,in a constructor as well being able to be initialized as they are declared
  • They can be declared as static

public class MyClass { public readonly double PI = 3.14159; }
public class MyClass { public readonly double PI; public MyClass() { PI = 3.14159; } }