asp.net - How to use a custom web control? -
i create control encapsulates following controls:
i've recreated html (excuse ugly table usage until clean divs , css) in control .ascx file:
<%@ control language="vb" autoeventwireup="false" codefile="multilevelreportfilter.ascx.vb" inherits="controls.multilevelreportfilter" %> <%@ register tagprefix="cc1" namespace="unlv.iap.webcontrols" assembly="dropdownchecklist" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content= "html tidy linux/x86 (vers 25 march 2009), see www.w3.org" /> <title></title> <style type="text/css"> /*<![cdata[*/ tr.c2 {display: none;} td.c1 {font-weight: bolder; color: red; font-size: 10pt;} /*]]>*/ </style> </head> <body> <table width="98%" cellspacing="0" cellpadding="15" align="center"> <tr> <td width="40%" valign="top"> <table width="600" cellspacing="0" cellpadding="4"> <tr> <td colspan="2" class="txtlabel c1" align="center">sales of</td> </tr> <tr> <td align="right" class="txtlabel" width="200">period </td> <td class="txtlabel" width="400"></td> </tr> <tr class="c2"> <td align="right" class="txtlabel" width="200">year </td> <td class="txtlabel" width="400"> month </td> </tr> <tr> <td align="right" class="txtlabel" width="200">accounts filter </td> <td></td> </tr> <tr> <td align="right" class="txtlabel" width="200">brands filter </td> <td></td> </tr> <tr id="tr1" runat="server" visible="false"> <td align="right" valign="top" class="txtlabel" width="200">business groups</td> <td></td> <td></td> </tr> <tr> <td align="right" valign="top" class="txtlabel" width="200">measurement</td> <td> <span class="txtlabel">display</span> </td> <td></td> </tr> </table> </td> <td width="60%" valign="top"> <table width="200"> <tr> <td width="20"><img src="/images/ico_graph1.gif" runat="server" id= "igenerate" /></td> <td width="180">generate report</td> </tr> <tr> <td width="20"><img src="/images/ico_print.gif" runat="server" id= "iprint" /></td> <td width="180">print</td> </tr> <tr> <td width="20"><img src="/images/ico_excel.jpg" runat="server" id= "iexport" /></td> <td width="180">export to excel</td> </tr> </table> </td> </tr> </table> </body> </html>
my question two-fold:
how include on page?
i've tried register control , reference it, i'm missing assembly information. can't seem find information on how register control in assembly:
<%@ register tagprefix="cc1" namespace="controls.multilevelreportfilter" assembly="multilevelreportfilter" %>
visual studio reports errors on line above because assembly incorrect.
is possible hide controls when calling page?
user controls not custom server controls.
if have ascx in same project go design mode , drag onto page want it.
if want share across multiple projects in same solution, scott gu wrote article explaining how reference , use user controls.
if not, best create server control.
Comments
Post a Comment