Skip to main content

Step:

· Open a Blank Default.aspx page from visual studio 2005.

· Go to the solution explorer and right click on to the Default.aspx and then click on the Add New Item.

· After that you have to select the Web User Control.ascx file from add new item dialog box.

· That page will be the same like as default asp page draw your user control on that page.

· Code on the User Control.ascx page: Code:

  • Open a Blank Default.aspx page from visual studio 2005.

  • Go to the solution explorer and right click on to the Default.aspx and then click on the Add New Item.

  • After that you have to select the Web User Control.ascx file from add new item dialog box.

  • That page will be the same like as default asp page draw your user control on that page.

  • Code on the User Control.ascx page:

     <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
     <table style="width: 330px">
       <tr>
         <td style="height: 148px" align="center">
           <asp:Label ID="Label1" runat="server" Text="Thanks To awadh Sir" Font-Bold="True" Font-Size="XX-Large" ForeColor="Red" Visible="False"></asp:Label>
         </td>
       </tr>
       <tr>
         <td style="height: 55px" align="center">
           <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
         </td>
       </tr>
     </table>
    

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>

<tr>

    <td style="height: 148px" align="center">

        <asp:Label ID="Label1" runat="server" Text="Thanks To awadh Sir" Font-Bold="True" Font-Size="XX-Large" ForeColor="Red" Visible="False"></asp:Label></td>

</tr>

<tr>

    <td style="height: 55px" align="center">

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td>

</tr>

For more details please check out this link...

http://www.mindstick.com/Articles/535bd817-c3c1-46dd-be9c-f14e42c7db78/?Creating%20User%20Define%20Control%20in%20ASP%20.Net

Thanks

Step:

· Open a Blank Default.aspx page from visual studio 2005.

· Go to the solution explorer and right click on to the Default.aspx and then click on the Add New Item.

· After that you have to select the Web User Control.ascx file from add new item dialog box.

· That page will be the same like as default asp page draw your user control on that page.

· Code on the User Control.ascx page: Code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>

<tr>

    <td style="height: 148px" align="center">

        <asp:Label ID="Label1" runat="server" Text="Thanks To awadh Sir" Font-Bold="True" Font-Size="XX-Large" ForeColor="Red" Visible="False"></asp:Label></td>

</tr>

<tr>

    <td style="height: 55px" align="center">

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td>

</tr>

For more details please check out this link...

http://www.mindstick.com/Articles/535bd817-c3c1-46dd-be9c-f14e42c7db78/?Creating%20User%20Define%20Control%20in%20ASP%20.Net

Thanks

Step:

  • Open a Blank Default.aspx page from visual studio 2005.

  • Go to the solution explorer and right click on to the Default.aspx and then click on the Add New Item.

  • After that you have to select the Web User Control.ascx file from add new item dialog box.

  • That page will be the same like as default asp page draw your user control on that page.

  • Code on the User Control.ascx page:

     <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
     <table style="width: 330px">
       <tr>
         <td style="height: 148px" align="center">
           <asp:Label ID="Label1" runat="server" Text="Thanks To awadh Sir" Font-Bold="True" Font-Size="XX-Large" ForeColor="Red" Visible="False"></asp:Label>
         </td>
       </tr>
       <tr>
         <td style="height: 55px" align="center">
           <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
         </td>
       </tr>
     </table>
    

For more details please check out this link...

http://www.mindstick.com/Articles/535bd817-c3c1-46dd-be9c-f14e42c7db78/?Creating%20User%20Define%20Control%20in%20ASP%20.Net

Thanks

Source Link

Step:

· Open a Blank Default.aspx page from visual studio 2005.

· Go to the solution explorer and right click on to the Default.aspx and then click on the Add New Item.

· After that you have to select the Web User Control.ascx file from add new item dialog box.

· That page will be the same like as default asp page draw your user control on that page.

· Code on the User Control.ascx page: Code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>

<tr>

    <td style="height: 148px" align="center">

        <asp:Label ID="Label1" runat="server" Text="Thanks To awadh Sir" Font-Bold="True" Font-Size="XX-Large" ForeColor="Red" Visible="False"></asp:Label></td>

</tr>

<tr>

    <td style="height: 55px" align="center">

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td>

</tr>

For more details please check out this link...

http://www.mindstick.com/Articles/535bd817-c3c1-46dd-be9c-f14e42c7db78/?Creating%20User%20Define%20Control%20in%20ASP%20.Net

Thanks