protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == true)
{
Sipom.DataSets.RelatorioTableAdapters.TodasTabelasTableAdapter Tabela = new
Sipom.DataSets.RelatorioTableAdapters.TodasTabelasTableAdapter();
Sipom.DataSets.Relatorio.TodasTabelasDataTable data = Tabela.GetDataTodos();
ReportViewer1.LocalReport.Refresh();
ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
}
public void SetSubDataSource(object remetente, SubreportProcessingEventArgs e)
{
Sipom.DataSets.RelatorioTableAdapters.TodasTabelasTableAdapter Tabela = new Sipom.DataSets.RelatorioTableAdapters.TodasTabelasTableAdapter();
Sipom.DataSets.Relatorio.TodasTabelasDataTable data = Tabela.GetDataTodos();
ReportDataSource RDS1 = new ReportDataSource("DSRespostas", (System.Data.DataTable)data);
ReportViewer1.LocalReport.DataSources.Add(RDS1); }
With this code I'm trying to process the subreport but the error appears in the following line: ReportViewer1.LocalReport.DataSources.Add(RDS1);
ERROR:
An exception of type 'System.InvalidOperationException' occurred in Microsoft.ReportViewer.WebForms.dll but was not handled in user codeAdditional information: The viewer control object is in read-only mode
Can someone help me? I can not solve this problem. What I want is to load the main report with the subreport using tableadpater
.