简体   繁体   中英

extending asp.net control in the website project

when I extend an asp.net control and place the extended control class in, say, Applicaton_code
(without specifying the namespace) how do i register the control to use it on a webpage?
what assembly name and namespace should be specified?

use :

<%@Register TagPrefix="local" Assembly="App_Code" Namespace="Controls" %>

Also, you HAVE to defines a namespace where to put your controls (from memory, when adding class to App_code, no namespace is generated by default).

namespace Controls {
    public class control1 : WebControl {
    }

}

and then , in the aspx file

<local:control1 runat="server", id="youreluckyitworks" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM