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 5946449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:49:29+00:00 2026-05-22T16:49:29+00:00

i am using crystal reports for the first time. I have written code which

  • 0

i am using crystal reports for the first time. I have written code which is as follows

public partial class _Default : System.Web.UI.Page 
{
    private ReportDocument report = new ReportDocument();
    protected void Page_Load(object sender, EventArgs e)
    {
        report.Load(Server.MapPath("CrystalReport1.rpt"));
        report.FileName = Server.MapPath("CrystalReport1.rpt");
        if (!Page.IsPostBack)
            {
                BindData();
            }
    }

protected override void OnUnload(EventArgs e)
{
    base.OnUnload(e);
    this.Unload+=new EventHandler(Page_Unload);
}

    public void Page_Unload(object sender, EventArgs e)
    {
        report.Clone();
        report.Dispose();
    }

private void BindData()
    {        
        Trusted_Connection=true";
        string connectionString = @"Data Source=WINSERVER;Initial Catalog=card;User       ID=sa;Password = db2admin";
        SqlConnection myConnection = new SqlConnection(connectionString);
        SqlDataAdapter ad = new SqlDataAdapter("SELECT name,address,idno FROM iffcar", myConnection);
        DataSet ds = new DataSet();
        ad.Fill(ds);
        DropDownList1.DataSource = ds;
        DropDownList1.DataTextField = "name";
        DropDownList1.DataValueField = "idno";
        DropDownList1.DataBind();
    }


protected void Btn_DisplayReport(object sender, EventArgs e)
    {

    int idno = Convert.ToInt32(DropDownList1.SelectedValue);
    report.SetParameterValue("idno", idno);
    CrystalReportViewer1.ReportSource = report;
    }
}

i am getting values in the dropdownlist but,
enter image description here

Now my problem is once i select a value from dropdownlist i want report of that value.
how to do it…..

please help me to solve my problem.

  • 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-22T16:49:30+00:00Added an answer on May 22, 2026 at 4:49 pm

    Try using the index number of the parameter:

    protected void Btn_DisplayReport(object sender, EventArgs e)
    {
       int idno = Convert.ToInt32(DropDownList1.SelectedValue);
       report.SetParameterValue(0, idno);
       CrystalReportViewer1.ReportSource = report;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created reports using Crystal Reports in my asp.net application(vb). It was fine.
I'm using Visual Studio 2005 with VB.NET. I have a number of Crystal Reports,
I'm using Crystal Reports for Eclipse 2.0.4 and I have a problem. I use
I have some reports developed using Crystal Reports 12 and I want to version
I have some Crystal Reports that were created using Crystal (external to Visual Studio)
I have a WinForms app built using Visual Studio 2005, including the crystal reports
I am updating an existing reporting system in ASP.NET which uses crystal reports. In
I'm using crystal reports 10 and have an issue with a duplex printer. Basically
I am using Crystal Reports in Visual Studio 2008. I have about 5 pages
I have Finished Designing my first Crystal Report using ASP.NET, I am Providing user

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.