Sharepoint solutions

November 17, 2007

Using ReportViewer control in Sharepoint

Filed under: main — admin @ 6:31 pm

ReportViewer can be used in Sharepoint to make reports. To do this – place ReportViewer on the aspx page. Create rdlc report file to show some table data, for example table – “Name – Age”. Then link ReportPath property with rdlc file and add data source in the DataSources collection. As we fill these properties in code, then that example can be easy modified to work with different rdlc files and different table data. More over, we can use session to pass data source to the code from another page.

ReportViewer folder contains VS2005 project that demonstrate using of this control. The files MyReport.aspx and MyReport.aspx.cs must be copied to the “layouts” folder, the Report.rdlc file must be copied to the root of your application virtual directory, where web.config is. To run example – open in the browser your site URL, followed by the _layouts/Myreports.aspx. You will see the followed picture:

If the user do not have access to read from the root of your virtual directory an error will appear. To resolve this problem you must give users privilege to read rdlc files.

November 13, 2007

Session state in MOSS

Filed under: main — admin @ 4:38 pm

By default sesion state is enabled for farms in sharepoint. To prove that go to Central Administration ->Application Management ->Office SharePoint Server Shared Services -> Configure session state. But, to use session in your code you must turn on session either in web.config or in your pages. One line in web.config must look like:
<pages enableSessionState=”true” … and one line must be uncomment: <add name=”Session” type=”System.Web.SessionState.SessionStateModule”/>. To turn on session in the specific page – simply set EnableSessionState=”True” in the Page directive.

Powered by WordPress