[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Questions on custom GenericWebPart and WebPartManager class?

Dave

2/26/2008 9:44:00 PM

In
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.gene...(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.