예제 #1
0
    protected void Drp_shop_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (Drp_shop.SelectedValue.ToString() != "0")
        {
            Hartford report = new Hartford();
            string   search = Drp_shop.SelectedItem.Text;

            if (Drp_shop.SelectedValue.ToString() != "")
            {
                Telerik.Reporting.Filter filter1 = new Telerik.Reporting.Filter();

                filter1.Operator   = Telerik.Reporting.FilterOperator.Equal;
                filter1.Expression = "=Fields.Shop";
                filter1.Value      = search;
                report.Filters.Add(filter1);
            }
            ReportViewer1.Visible = true;
            ReportViewer1.Report  = report;
            Monthstartlbl.Text    = "";
            Monthendlbl.Text      = "";
        }
    }
예제 #2
0
    public void BindDataset()
    {
        var    objectDataSource  = new Telerik.Reporting.ObjectDataSource();
        string selectCommandText = "";
        string Start             = Monthstartlbl.Text.ToString();
        string End = Monthendlbl.Text.ToString();
        //Getting Datasouce
        SqlConnection con          = new SqlConnection(Repository.Connection.DBConnectionString());
        SqlCommand    mySqlCommand = con.CreateCommand();

        mySqlCommand.CommandText = "ReportHartford_byDate_sp";
        mySqlCommand.Parameters.Add("@Startdate", SqlDbType.NVarChar, -1).Value = Start;
        mySqlCommand.Parameters.Add("@Enddate", SqlDbType.NVarChar, -1).Value   = End;
        mySqlCommand.CommandType = CommandType.StoredProcedure;

        SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();

        mySqlDataAdapter.SelectCommand = mySqlCommand;
        DataTable dt = new DataTable();

        con.Open();
        mySqlDataAdapter.Fill(dt);

        objectDataSource.DataSource = dt;


        Hartford HartReport = new Hartford();

        HartReport.DataSource = objectDataSource;

        Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
        reportSource.ReportDocument = HartReport;


        ReportViewer1.ReportSource = reportSource;
    }