I am new to Sharepoint. I need to know the best way to add a ReportViewWebPart to a page through C# code behind.
I have tried accessing the web part from WebPartCatalog. It leads me to the NullReferenceException
.
Then I tried by creating instance for ReportViewerWebPart
and add the properties for ReportPath, Title, etc., it leads me to Object Reference Not Set to an Instance of an Object
exception.
But I could add other web parts to a page as normal.