Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:18:33+00:00 2026-05-24T23:18:33+00:00

I have a Crystal Report created in Visual Studio 2008 which displays various stock

  • 0

I have a Crystal Report created in Visual Studio 2008 which displays various stock codes with their prices. The Group Tree for the Crystal Report Viewer is enabled & displays a list of the stock codes for easy navigation. The list in the Group Tree can become quite long (100+ stock codes), which causes a scroll bar to appear.

Problem is, when the user selects a stock code from the Group Tree, the page posts back & the scroll position on the Group Tree is lost. This is particularly frustrating, especially when you’re working with stock codes that are towards the end of the list.

Is there any way that I could get the current scroll position of the Group Tree, save it & re-assign it after the report has reloaded?

Some things I have tried, but without much success:

The Group Tree is rendered as a div, but without an ID. So I’ve retrieved the Group Tree control from the server side by using the Report Viewers Controls collection (it’s the 4th control in the collection) & checked its UniqueID value. I then used that to call document.getElementById(), but this always returns null.
Also, I’m unable to use the control I retrieve from server-side, as I can’t find the class (CrystalDecisions.Web.CrystalReportGroupTree), which is the type supplied when calling GetType() on the Group Tree control.

Any assistance in this matter will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:18:35+00:00Added an answer on May 24, 2026 at 11:18 pm

    So I’ve found a solution that works pretty well. I’ve created my own “Group Tree” using a ListBox & positioned it next to the CrystalReportViewer, hiding the viewers actual GroupTree. The ListBox maintains its own scroll position, as well as the current selection. The added bonus with this approach is that users can use the arrow keys to navigate the GroupTree, as long as it has focus.

    My method of implementation is as follows:

    I’ve added a standard ListBox control to the page & positioned it to the left of the CrystalReportViewer. The markup is as follows:

    <asp:ListBox ID="lstStockCode" runat="server" Width="185px" Height="760px" Font-Size="10pt" AutoPostBack="true" OnSelectedIndexChanged="lstStockCode_SelectedIndexChanged" DataTextField="StockCode" DataValueField="ID" BackColor="#E4E4EC" style="position: relative; top: 30px; border-width: 0px;" Visible="false"></asp:ListBox>
    

    The CrystalReportViewer is initially hidden, until the report criteria have been selected, at which point both the Viewer & ListBox will become visible.

    Next, bind the ListBox to a data source that returns the same data as what the report is bound to. In my case, I had created a method to retrieve stock codes using the same SQL query as the Stored Procedure my report is bound to.

    Lastly, search the displayed Report for the value selected in the ListBox. Below is a sample of the SelectedIndexChanged Event:

    protected void lstStockCode_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ViewState["PrevListIndex"] == null)
            CrystalReportViewer1.SearchAndHighlightText(lstStockCode.SelectedItem.Text, CrystalDecisions.Shared.SearchDirection.Forward);
        else if (Convert.ToInt32(ViewState["PrevListIndex"]) < lstStockCode.SelectedIndex)
            CrystalReportViewer1.SearchAndHighlightText(lstStockCode.SelectedItem.Text, CrystalDecisions.Shared.SearchDirection.Forward);
        else if (Convert.ToInt32(ViewState["PrevListIndex"]) > lstStockCode.SelectedIndex)
            CrystalReportViewer1.SearchAndHighlightText(lstStockCode.SelectedItem.Text, CrystalDecisions.Shared.SearchDirection.Backward);
    
        ViewState["PrevListIndex"] = lstStockCode.SelectedIndex;
    
        CrystalReportViewer1.ToolbarStyle.Width = Unit.Parse("1096px");
        lstStockCode.Focus();
    }
    

    Because the search direction needs to specified for the CrystalReportViewer, I just store my current search index & determine whether I’m searching further down or back up in the report, seeing as my ListBox is returned using the same query as my report & thus is in the same order as the report data.

    A few things of interest about this implementation, mostly in terms of styling. The supplied code does not make provision for the repositioning of the CrystalReportViewer Toolbar. While the ListBox sits in line with the report, it only has whitespace above it where the Toolbar would normally sit. Also, the TreeView-like dotted lines do not appear inside the ListBox. I haven’t played around with using a TreeView control as opposed to a ListBox to achieve the same effect but I believe it to be very doable.

    Even with these differences in terms of look & feel, the client was unaware that a new control was built to achieve this goal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a class which builds a Crystal report and displays it in
I am creating a report in Visual Studio 2008. My crystal report is created
We have several reports created with the crystal reports included with Visual studio 2008.
I am using Crystal Reports inside Visual Studio 2005. I have created a report
I have a report that I created with Crystal Reports 2008. This report uses
I have a Crystal Report in Visual Studio 2010 and I want to select
I have some Crystal Reports that were created using Crystal (external to Visual Studio)
I am using Visual Studio 2008(vb.net), SQL Server 2008 and Crystal Report 9. I
I have a Windows Forms application that was created in Visual Studio 2008 and
I have created ASP.net Web application which uses Crystal Report to show reports. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.