[quoted text, click to view] On Fri, 19 Aug 2005 12:31:05 -0700, Clift wrote:
> Do you have any good sources that could explain this process ?
>
> "intrader" wrote:
>
>> On Fri, 19 Aug 2005 09:07:05 -0700, Clift wrote:
>>
>> > I have created a DHTML menu and wrapped it into a asp.net user control
>> > library. I am able to use this in any project by using <%@ Register
>> > TagPrefix="uc1" TagName="menu" Src="...%>. The Src attribute is the problem.
>> > Can anyone give me any information on how to locate my .ascx control in one
>> > central location on my Web Server and access it ? Currently, I can only copy
>> > it into each project directory and I don't want to have to do this everytime
>> > I change the control.
>> >
>> > Thanks in advance,
>> By definition the src attribute may refer only to a virtual path.
>>
>> If you wish to share user controls convert them to custom controls and
>> compile them to a .dll which you can place in the central bin folder of
>> your site.
>>
In MSDN there are a few examples.
In a nutshell:
1. Convert your ascx to a class.
2. For controls in your ascx add a protected field with proper control
class.
3. Provide a constructor for the class that allows you to pass the
context. You will be calling this constructor from your Page_Load event
(in your code-behind file) - this way your class now can still do things
like Response.Write. 4. Provide the Render method overrides to render the
controls
4. Compile the class.
5. In your main page make reference to your class via <%@ Import ...%>