Beispiel #1
0
        private void BindReport()
        {   
            string sAccoutList = String.Join(";", lstAccountType.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());
            string sAccount2 = String.Join(";", lstAccount2.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());
            string sStateList = String.Join(";", lstState.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());
            string sCSNRepList = String.Join(";", lstCSNRep.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());
            string sTerritory = String.Join(";", lstTerritory.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());
            string sPlatform = String.Join(";", lstPlatform.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray());

            string sPrimaryDist = String.Join(";", lstPrimaryDistributor.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value).ToArray()); 

            IList<vwAccountList> values1;
            dynamic result; 
            DataSet ds = new DataSet();
            clsReports obclsReports = new clsReports();
            ds = obclsReports.RptAccountList(sAccoutList, sAccount2, sStateList, sCSNRepList, sTerritory, sPlatform, sPrimaryDist);
            ReportDataSource rds = new ReportDataSource("dsAccountList", ds.Tables[0]);
            ReportViewer1.LocalReport.DataSources.Clear();
           ReportParameter[] rParam = new ReportParameter[chkColumnList.Items.Count];
       for (Int32 i = 0; i < chkColumnList.Items.Count; i++)
        {
          rParam[i] = new ReportParameter(chkColumnList.Items[i].Value, (chkColumnList.Items[i].Selected == true ? "True" : "false"));
        }
        ReportViewer1.LocalReport.SetParameters(rParam);
            ReportViewer1.LocalReport.DataSources.Add(rds); 
            ReportViewer1.LocalReport.Refresh();
        }