Philippsen's Blog

Everyday findings in my world of .net and related stuff

Archive for the ‘Reporting Services’ Category

Find out which control triggered post back event

Posted by Torben M. Philippsen on January 3, 2011

In a recent Reporting Services web project I used the ReportViewer control to display reports.

In order to position some asp.net controls properly according to whether the parameters bar was present or not, I needed to determine if the “view report” button was clicked – causing the postback. Analyzing the html output of the reportviewer control, I needed to deterrmine if the control with id “ReportViewer1_ctl00_ctl00” caused the postback.

This is what I did:

    Control ctrl = GetPostBackControl(this);

    if (ctrl.ClientID.Equals(“ReportViewer1_ctl00_ctl00”))

    {

        ImageButton1.CssClass = “”;

        LinkButton1.CssClass = “LinkButton”;

    }

 

And the code for the GetPostBackControl method:

    public static Control GetPostBackControl(Page page)

    {

        Control control = null;

        string ctrlname = page.Request.Params.Get(“__EVENTTARGET”);

        if (ctrlname != null && ctrlname != string.Empty)

        {

            control = page.FindControl(ctrlname);

        }

        else

        {

            foreach (string ctl in page.Request.Form)

            {

                if ((ctl.LastIndexOf(“.x”) > 0) || (ctl.LastIndexOf(“.y”) > 0))

                {

                    control = page.FindControl(ctl.Substring(0, ctl.Length – 2));

                    break;

                }

                control = page.FindControl(ctl);

                if ((control is System.Web.UI.WebControls.Button))

                {

                    break;

                }

            }

        }

        return control;

    }

Advertisements

Posted in asp.net, Reporting Services | Tagged: , | 1 Comment »

Reporting Services – rsAccessDenied error

Posted by Torben M. Philippsen on October 13, 2010

Today I had to prepare a new SQL Server Reporting Services installation for a workshop I will be giving this friday. I’ve performed this task a lot of times but always on “real” server OS’s – never on a desktop OS, which this has to be.

The installation went pretty much by itself, but after runing the Reporting Services Configuration Manager and opening http://localhost/reports I got the following error:

The permissions granted to user ‘domain\username’ are insufficient for performing this operation. (rsAccessDenied)

After some googling I finally found a solution that I thought I would share:

  • Make sure you have access configured to the URL http://localhost/reports using the SQL Reporting Services Configuration. To do this:
  • Open Reporting Services Configuration Manager -> then connect to the report server instance  -> then click on Report Manager URL.
  • In the Report Manager URL page, click the Advanced button -> then in the Multiple Identities for Report Manager, click Add.
  • In the Add a Report Manager HTTP URL popup box, select Host Header and type in: localhost
  • Click OK to save your changes.
  • Now start/ run Internet Explorer using Run as Administator…  
  • NOTE: If you don’t see the ‘Site Settings’ link in the top left corner while at http://localhost/reports it is probably because you aren’t running IE as an Administator or you haven’t assigned your computers ‘domain\username’ to the reporting services roles, see how to do this in the next few steps.
  • Then go to: http://localhost/reports   (you may have to login with your Computer’s username and password)
  • You should now be directed to the Home page of SQL Server Reporting Services here: http://localhost/Reports/Pages/Folder.aspx
  • From the Home page, click the Folder Settings tab, then click New Role Assignment
  • In the Group or user name textbox, add the ‘domain\username’ which was in the error message (you can find the domain\username for your computer in the rsAccessDenied error message).
  • Now check all the checkboxes; Browser, Content Manager, My Reports, Publisher, Report Builder, and then click OK.
  • You’re domain\username should now be assigned to the Roles that will give you access to deploy your reports to the Report Server.  If you’re using Visual Studio or SQL Server Business Intelligence Development Studio to deploy your reports to your local reports server, you should now be able to.

Just to let You know, this solution applies to windows 7 running SQL Server 2008 Developer Edition

Posted in Reporting Services | Tagged: , | 1 Comment »

 
%d bloggers like this: