SAP Knowledge Base Article - Public

1307513 - How to retrieve selected group tree element in Crystal Reports using .Net SDK.

Symptom

How to retrive the name of group element selected in a Crystal Reports.

Reproducing the Issue

  1. Create a report which contains groups.
  2. Add the report to .Net web-application.
  3. Assign the report to viewer in application.
  4. Execuite the application.
  5. Select an element in the group tree in report.
  6. User wants the name of the selected element.
  • Visual Studio 2005.
  • Crystal Reports XIR2.
  • Resolution

    1. Create a report which contains groups.
    2. Add the report to .Net web-application.
    3. Assign the report to viewer in application.
    4. Add following line of code to the CrystalReportViewer_navigate() method:

              string groupName = Server.UrlDecode(Request.Form["__EVENTARGUMENT"].ToString());
              int i;

              // The groupname always starts with 'drillname=' so well get rid of that first
              groupName = groupName.Replace("drillname=", "");

              // Find the location of '&grp=' in this string as it at the end
              i = groupName.Length - groupName.IndexOf("&grp=");

              // drop everything from '&grp=' and back. This is now the group name
              groupName = groupName.Substring(0, groupName.Length - i);

    5. Display the groupName value in the application.

    See Also

    See Note number:1308698 to create CrystalReportViewer_navigate() method.

    Keywords

    dot net, vs, cr, gptree , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

    Product

    SAP Crystal Reports XI R2