Showing posts with label User Controls. Show all posts
Showing posts with label User Controls. Show all posts

Wednesday, August 7, 2013

How to create and consume usercontrol without vs.net

Title:How to access user control in asp.net

Description:The use controls can be used when we require a control which can be working as per our requirement.Now i would like to explain how to access this into our web application
1.Use notepad or some other editor and write all aspx/js/html code in it.Save it with .ascx extension
2.Add the created .ascx to the current project i:e copy it into current project folder
3.Go to the page where we want to consume this control and add <%@Register--%> directive
<%@Register Tagprefix="Nit" TagName="RichBanner" src="banner.ascx"%>
4.In the same page now create controls using markup
<Nit:RichBanner ID="rbl" runat="server"/>
5.To Create a control; at run time we cannot use normal syntax for use defined control.We must use load method of page to create it

Ex:-Banner a=page.Load("Banner.ascx")
similarly unload(--) to remove the controls form  form
Remember we must add it to some container after creating it
6.Every control once designed can be placed onto an assembly
7.Only ascx with a dll will be prepared and given to user(publish required)
8.<%@ control--%> directive is used instead of <%@ page--%> and contains will be placed inside a page which contains all HTML content

Bel