views:

13

answers:

0

Hi All,

Can anyone tell me how I should go about building a custom dataview webpart (i.e. dataform web part)?

this is the code that I have got so far:

[DefaultProperty("Text"), ToolboxData("<{0}:DataViewWP runat=server>"), XmlRoot(Namespace = "DataViewWP")]
public class DataViewWP : Microsoft.SharePoint.WebPartPages.DataFormWebPart {
public DataViewWP()
{
}
}

My issue with this is that when I deploy it, pop-up says: Unable to add web part, Data view web part: An error has occurred

When I look in the latest log file in the logs folder I find the the following:

Failed to add webpart "file name.dwp"

Exception System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed. at System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at Microsoft.SharePoint.WebPartPages.WebPartImporter.GetTypeForObjectModel(Assembly assembly, String typeName) at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections) at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlRead...

and so on....

The webpart is specified in the web.config file to be a safe control

Strangely enough, if I inherit from Microsoft.SharePoint.WebPartPages.WebPart, then I do not any issue adding it to the page!

Can anyone help me identify what the issue is? Also, any tips on writing custom data form web parts is also much appreciated..

Thanks, Freddy K

related questions