1
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 am trying to process the sub-report 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 code
Additional information: The viewer control object is in read-only mode
Can anyone help me? I’m not managing to solve this problem. What I want is to load the main report with the sub-report using the tableadpater
.
Welcome to Stack Overflow, Vasconcelos! While waiting for someone who can answer your question, ask tour to understand why Chun edited his question... for a medal! ;)
– Daniel