Hi Sezai,
After a bit of further research and experimentation, I got this going, and I thought I'd share the key points with the list. Your points 2 and 3 below are absolutely correct: 2. The namespace must match exactly with the GAC'ed assembly. 3. The class your using within your GAC'ed assembly needs to inherit from System.Web.UI.UserControl But the Control directive was the one that we found hardest to get right. The steps to get it right we found worked best are: 1. Develop a class that inherits from (as you said) System.Web.UI.UserControl, named for example CustomControlA, and publish in an assembly named for example AssemblyA. 2. Choose the namespace hierarchy you need, such as "YourCompany.OuterNamespace.InnerNamespace". 3. Build your assembly, strongly named of course. 4. Install into the GAC 5. Determine the full name of the Assembly (e.g. "AssemblyA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0e13e58ad274a277") 6. The name of the class fully qualified by namespace <%@ Control Language="C#" AutoEventWireup="true" Inherits=" YourCompany.OuterNamespace.InnerNamespace.CustomControlA, AssemblyA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0e13e58ad274a277" %> The key to getting it working is the slightly obscure syntax of the Inherits attribute of the Control directive. The bit before the *first* comma is the class name, fully qualified by namespace, and after the first comma is the full name of the Assembly, also delimited internally with commas ... Note also there's no CodeBehind / CodeFile attribute as there's no uncompiled code involved, just your already GAC'ed assembly. Hope that may help others struggling to get this working. Cheers, Trevor Andrew From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sezai komur Sent: Tuesday, 28 October 2008 5:17 PM To: [email protected] Subject: Re: [OzMOSS] RE: SharePoint Custom Edit Form ASCX using GAC based assembly Check these: 1. The .ascx file should contain something like this in its first line <%@ Control Language="C#" AutoEventWireup="true" Inherits="YourNamespace.MoreNamespace.YourUserControl" CodeBehind="YourUserControl.ascx.cs" %> 2. The namespace of your code file needs to match the namespace specified in the .ascx 3. You code file needs to inherit from System.Web.UI.UserControl probably more to it - but that's all I can think of at the moment. Sezai On Tue, Oct 28, 2008 at 3:24 PM, Trevor Andrew <[EMAIL PROTECTED]> wrote: Hi All, I've got a custom edit form ASCX which includes an SPDataSource and SPGridView control. We have a number of methods that respond to the OnInit method of the SPDataSource originally ... We've got all this going using a "codefile" distributed with the ASCX, but we'd obviously prefer to distribute the code as a GACable assembly ... We've been able to create the class, reference it using an Assembly directive within the ASCX control, but we don't seem to be able to directly reference the methods in the assembly from the "inline" event attributes within the markup of the ASCX control. For example, in the SPDataSource definition, we have an OnInit attribute: OnInit=" onDsImagesOnInit" When the code was in the codefile associated with the ASCX this all worked fine. We've tried a number of combinations such as qualifying the method name with the assembly name, the namespace qualified assembly name ... but we always get the same sort of error message: 'ASP.editxxx_ascx' does not contain a definition for 'assemblyName' and no extension method 'assemblyName' accepting a first argument of type 'ASP.editxxx_ascx' could be found (are you missing a using directive or an assembly reference?) C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts\SPControls\xxx.ascx Any thoughts on the correct approach for this would be much appreciated Cheers, Trevor ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com
