using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;

using System.Data;
using System.Data.SqlClient;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

I am using the above header files

public class ApplicationForm : System.Web.UI.WebControls.WebParts.WebPart
        // WebPart Parameter for getting the Connection string
        WebDisplayName("Connection String"),


It throws an error for custom attribute:

Error   1   Attribute 'WebBrowsable' is not valid on this declaration type. It is only valid on 'property, indexer' declarations.
  • 2
    Is that the complete snippet? As mentioned in the error the attributes should be on a Property or an Indexer. The snippet given in the question does not have anything after the attributes – Hari Pachuveetil Oct 2 '11 at 16:12
  • You're welcome. You could post it and mark that as the answer – Hari Pachuveetil Oct 2 '11 at 17:15
  • See my question for a complete example (and an easy way to add web part properties!). – Kit Menke Oct 2 '11 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.