c#


ReportViewer multiple result of listbox


I have to make a Report with a list box where multiple results are selected
Image
but when I get to the datatable I do not know how to make it show the result of the different values. Selected.
This is my code...
protected void CargaReporte(object sender, EventArgs e)
{
dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable dt = new dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable();
dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter da = new dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter();
ReportDataSource RD = new ReportDataSource();
List<dynamic> lst = new List<dynamic>();
if (ddUsu.SelectedIndex == 0)
{
foreach (ListItem item in ddUsu.Items)
{
if (item.Selected)
{
da.Fill(dt, int.Parse(ddUsu.SelectedValue));
lst.Add(dt);
}
}
}
else
{
da.Fill(dt, int.Parse(ddUsu.SelectedValue == "" ? "0" : ddUsu.SelectedValue));
}
divReporte.Visible = true;
RD.Value = lst.ToArray();
RD.Name = "dbCalendarioEventos";
rvReporteCalendarioEventos.LocalReport.DataSources.Clear();
rvReporteCalendarioEventos.LocalReport.DataSources.Add(RD);
rvReporteCalendarioEventos.LocalReport.ReportEmbeddedResource = "ReporteCalendarioEventos.rdlc";
rvReporteCalendarioEventos.LocalReport.ReportPath = #"Reportes\Calendario\ReporteCalendarioEventos.rdlc";
rvReporteCalendarioEventos.LocalReport.Refresh();
}
How can I fill out the report with two or more results?
Resolved:
Create an additional DataTable to save the information set after the path through the foreach and so I can get the result I share part of the code.
string participante = (txtParticipante.Value == "" ? " " : txtParticipante.Value);
dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable dt = new dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable();
DataTable table = new DataTable();
dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter da = new dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter();
ReportDataSource RD = new ReportDataSource();
table = dt.Clone();
var FechaInicio_ini = FechaInicio(CEV_FECHA_INICIO_ini.Value);
var FechaInicio_fin = FechaFin(CEV_FECHA_INICIO_fin.Value);
var FechaFin_ini = FechaInicio(CEV_FECHA_FIN_Ini.Value);
var FechaFin_fin = FechaFin(CEV_FECHA_FIN_fin.Value);
try
{
if (ddUsu.SelectedValue != "")
{
foreach (ListItem item in ddUsu.Items)
{
if (item.Selected == true)
{
da.Fill(dt, int.Parse(item.Value),
FechaInicio_ini, FechaInicio_fin,
FechaFin_ini, FechaFin_fin,(txtParticipante.Value == "" ? " " : txtParticipante.Value));
foreach (DataRow dr in dt)
{
table.Rows.Add(dr.ItemArray);
}
}
}
}
else
{
foreach(ListItem item in ddUsu.Items)
{
da.Fill(dt, int.Parse(item.Value == "" ? "0" : item.Value),
FechaInicio_ini, FechaInicio_fin,
FechaFin_ini, FechaFin_fin, (txtParticipante.Value == "" ? " " : txtParticipante.Value));
foreach (DataRow dr in dt)
{
table.Rows.Add(dr.ItemArray);
}
}
}
divReporte.Visible = true;
RD.Value = table;
RD.Name = "dbCalendarioEventos";
rvReporteCalendarioEventos.LocalReport.DataSources.Clear();
rvReporteCalendarioEventos.LocalReport.DataSources.Add(RD);
rvReporteCalendarioEventos.LocalReport.ReportEmbeddedResource = "ReporteCalendarioEventos.rdlc";
rvReporteCalendarioEventos.LocalReport.ReportPath = #"Reportes\Calendario\ReporteCalendarioEventos.rdlc";
rvReporteCalendarioEventos.LocalReport.Refresh();
}
catch(Exception ex) { }
}
image 2

Related Links

I'm trying to find a XML node by searching for an attribute using a substring
Build HyperLink within GridView for each row
Enabel Excel Autofilter when export the data from gridview
Download a PDF (not opening it in browser) when clicked
Problems with wrapping static type
rdlc report showing empty data
c#: xsl:include when calling XslCompiledTransform.Load()
Azure storage analytics log parse error
Procedure or function 'employee_pro' expects parameter '#empid', which was not supplied
C# pressing key breaks movement of an object
For some functions in WCF string[] is not converted to List<string>
c# copy to clipboard not working in running time
Odata Wcf data service .NET client event notification
Margin in MigraDoc
Correct way to implement MVVM Design pattern when using SQLite
Camera Lerp seems to be incrementing every loop

Categories

HOME
oauth-2.0
airflow
kendo-ui
domain-driven-design
casting
gaussian
bitbucket
artifactory
checkpoint
wavefront
annyang
select2
camunda
comma
luis
filehelpers
alert
django-rest-auth
scotty
hololens
beaker-notebook
tcpdf
sphinx4
recreate
selenium3
deferred
loopback
kubectl
jsonapi-resources
imageprocessor
openvms
wunderground
gstreamer-1.0
dotnetnuke-module
const
linkurious
file-conversion
azure-web-roles
socketcluster
compiled-query
test-kitchen
binary-decision-diagram
activeandroid
opos
pyopenssl
lucee
px4
playframework-2.3
boost-regex
dmalloc
grib
spring-cloud-aws
timex
scrollmagic
group
sqlproj
jspx
require-handlebars
mate-desktop
falcon
angularfire
angular-i18n
razorengine
phpdesigner
usps
jmap
sqlxml
stdlist
alchemy
methodology
clear
opendolphin
recode
webservices-client
android-networking
transparentproxy
glog
log-analysis
httpmodule
method-overloading
uiblureffect
javadb
qf-test
lwuit
step
behance-api
dateadd
sendy
complete
code-complete
google-mirror-api
kohana-orm
screensharing
android-memory
bindinglist
pdf-reader
diazo
animationdrawable
joomla1.7
nsundomanager
ruby-1.9
scriptmanager
copyfile
gmagick
iphone-maps
pitch-shifting
large-data-volumes

Resources

Encrypt Message