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?
Asked
Active
Viewed 2,721 times
4

John Saunders
- 160,644
- 26
- 247
- 397

Greg
- 1,227
- 5
- 23
- 52
1 Answers
9
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" />

Steve B
- 36,818
- 21
- 101
- 174
-
it missed an "at" sign actually, thanks for your vigilance :) – Steve B Jun 21 '11 at 19:04