Hey Paul

Try typing a dot after LinqVWP and see what intellisense gives you. You should 
see a list of classes, those contained in the namespace. One of them should be 
the class for your web part

Luis


On 22/02/2012, at 1:42 PM, Paul Noone wrote:

> Hi Callum,
> 
> Yes, that’s correct. But I don’t seem to be able to instantiate it. I keep 
> getting “LinqVWP is a namespace but is used like a type”. Not sure how to get 
> this properly and was hoping there might be a simple method to add a web part 
> by name from the gallery?
> 
> I have:
> 
> namespace ReceiversAndWPs.LinqVWP
> {
>     [ToolboxItemAttribute(false)]
>     public class LinqVWP : WebPart
>     {
>  
> 
> And in my receiver AddWebPart function:
>  
> LinqVWP wp = new LinqVWP();
>  
> 
> From: [email protected] [mailto:[email protected]] On Behalf 
> Of Callum Bundy
> Sent: Wednesday, 22 February 2012 1:03 PM
> To: ozMOSS
> Subject: RE: Provision non-XSLT WP to existing page via feature receiver
>  
> 
> Sorry I have just re-read your email.
> 
> You want to instantiate your custom web part class then, so if you have a 
> custom web part called MyWebPart you want to create a new instance of that, 
> instead of the base class WebPart.
> 
>  
> 
> Callum
> 
> From: [email protected] [mailto:[email protected]] On Behalf 
> Of Paul Noone
> Sent: Wednesday, 22 February 2012 12:56 PM
> To: ozMOSS ([email protected])
> Subject: Provision non-XSLT WP to existing page via feature receiver
>  
> 
> Hi all,
> 
> I am able to add new instances of ListViewWebParts am struggling to do the 
> same with my custom webpart.
> 
> How can I add an instance of a web part that is being deployed within the 
> same feature?
> 
> 115 static public void AddWebPart(SPWeb site, string pageUrl, string wpName, 
> string zone)
> 116 {
> 117     SPFile wpPage = site.Files[pageUrl];
> 118     SPLimitedWebPartManager wpManager = 
> wpPage.GetLimitedWebPartManager(ASP.PersonalizationScope.Shared);
> 119     WebPart wp = new WebPart();
> 120
> 121     wp.Title = wpName;
> 122     wpManager.AddWebPart(wp, zone, 0);
> 123 }
>  
> 
> Line 119 is giving the following error:
> 
> Cannot create an instance of the abstract class or interface 
> 'Microsoft.SharePoint.WebPartPages.WebPart'.
> 
> Kind regards,
> 
> Paul Noone
>  
> ---------------------------------------------------
> Online Developer/SharePoint Administrator
> Infrastructure Team, ICT
> Catholic Education Office, Sydney
> p: (02) 9568 8461
> f: (02) 9568 8483
> e: [email protected]
> w: http://www.ceosyd.catholic.edu.au/
>  
> 
>  
> The information contained in this email communication may be proprietary, 
> confidential or legally professionally privileged. It is intended exclusively 
> for the individual or entity to which it is addressed. You should only read, 
> disclose, re-transmit, copy, distribute, act in reliance on or commercialise 
> the information if you are authorised to do so. Evolve Information Services 
> does not represent, warrant or guarantee that the content is free of 
> omissions, errors, viruses or interference. If you are not the addressee or 
> intended recipient please notify us by replying direct to the sender and then 
> destroy any electronic or paper copy of this message.
> _______________________________________________
> ozmoss mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to