ASP.NET User Control Basics:

ASP.NET User Control Basics:

As we seen in the past post “Introduction of ASP.NET Server Control Basics ” what is the control and basic introduction of the asp.net controls, and how many types of controls are in .net also we know basic thing of the controls. But some time user wants to your won controls. He wants to more or other type of controls, or he want to combine more the two controls together. And Make some extra work. For solving of these Question .net provide to facility to user that he create over own controls. And use this controls in asp.net application weather it is web application or windows application.


In this post we explain how to make control in asp.net, for making new controls basically we combined two or more than two controls and want to use combined properties of these controls.
Here we get a Example to do this task.Now here we want to make a menu control and use it:-
 For making this we consider only graphical use her we not consider to event. First we understand this then we move to the coding part.
We take three page Home, About us, Contact us. And we make a menu controls.
Advantage of this control: once we make this type of controls the we use this any page for taking menu. And we also use this controls any other web site by simple drag and drop.

First make a new web application and right click on the web application name in solution windows .And select new item tab.

user_defiend_control

Select user control and click on Add button.


ASP.NET User Control Basics:
ASP.NET User Control Basics:

Write this code in this page and save it. Remember give the pages name with .aspx in the place of # in anker tag <a> on href property.

<div >
    <h3 class="heading">      
    <a href="#" >Home</a> <a href="#" class="Sam_btn_menu">
       About Us</a> <a href="#" >Contact Us</a></h3>
</div>
Your control is ready drag and drop this page where you want to use.

ASP.NET User Control
ASP.NET User Control Basics:


Old Post:

Reference :