C# : Tutorial of Asp.net with c# and example

Example and code about windows application, web application, SQL, C#, WPF etc which is helpful to developer and programer.

Search This Blog

User Control:How do i create user define control in asp.net c#

♠ Posted by Unknown in at Sunday, August 03, 2014

How use Userdefine Control in Asp.Net

For create asp.net user define control using c# following step perform

Definition of UserControl in Asp.Net :

In Asp.Net Web server controls , you can create your own custom, reusable controls using following step. These controls are called user controls.

A user control is a kind of composite control that works much like an ASP.NET other server control . you can add existing Web server controls and markup to a user control, and define properties and methods for the control. You can then embed them in ASP.NET Web pages like same as other server control.

Start Visual Studio 2005.

File -New-Project Type Visual C#.

Step 1: Adding a user control to the web site

Adding a user control to your solution is real simple. You just have to right click your solution and click Add New Item; then from the dialog window click Web User Control and name the control YourControl.ascx.

Step 2: Adding the ASP.NET controls to YOURControl.ascx

As mentioned earlier this user control will merely consist of a GridView and a SqlDataSource ASP.NET server controls.
Before we go ahead and add our controls to the user control, notice that the Page directive is not used for our user control, and that it has been replaced with the Control directive.

If our post is useful please share and comment on our post for more post and detail Visit :



Post a Comment