Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Questions on custom GenericWebPart and WebPartManager class?

Reply
Thread Tools

Questions on custom GenericWebPart and WebPartManager class?

 
 
Dave
Guest
Posts: n/a
 
      02-26-2008
In
http://msdn2.microsoft.com/en-us/lib...rt(VS.80).aspx

it states...
"..If you inherit from the GenericWebPart class, you also need to inherit
from the WebPartManager class and override its CreateWebPart method to enable
it to create your custom control..."

However, I've tried this using two classes

public class CustomGenericWebPart : GenericWebPart
{
public CustomGenericWebPart(Control control) : base(control) {}
}

public class CustomWebPartManager : WebPartManager
{
public CustomWebPartManager()
{
//
// TODO: Add constructor logic here
//
}

override public CustomGenericWebPart CreateWebPart (Control control)
{
CustomGenericWebPart customWebPart; //just to see if I can return
it....
return customWebPart;
}
}

error...
return type must be 'System.Web.UI.WebControls.WebParts.GenericWebPart ' to
match overridden member
'System.Web.UI.WebControls.WebParts.WebPartManager .CreateWebPart(System.Web.UI.Control)'

Do I have somehow use the "new" when declaring this? When I tried that it
stated

Type 'CustomWebPartManager' already defines a member called 'CreateWebPart'
with the same parameter types.

I'm having a hard time finding any sample code but apparently you can do
according the MS link.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
anonynousIdentification and WebPartManager =?Utf-8?B?QmlsbCBNaWxk?= ASP .Net 1 02-14-2006 04:43 PM
WebPartManager: disable Personalization and still use WebPartManger.AddWebPart() SlimFlem ASP .Net 9 01-09-2006 10:35 PM
WebPartManager.AddWebPart...not understanding exception SlimFlem ASP .Net 3 01-07-2006 02:49 PM
Programattically control WebPartManager outside of ASP Page? =?Utf-8?B?Q0JyZXRhbmE=?= ASP .Net 0 11-16-2005 03:31 PM
WebPartManager Import method =?Utf-8?B?U2hhdW4=?= ASP .Net 0 07-27-2005 02:17 PM



Advertisments