hemaljoes 0 Newbie Poster

hi,

I want to add the same ReportViewer control to the different PlaceHolders.

This is what i tried

PlaceHolder placeHolderDate = (PlaceHolder)TCMain.FindControl("TP" + monitoringObjectName).FindControl("TCInner"+monitoringObjectName).FindControl("TPDate"+monitoringObjectName).FindControl("PHDate"+monitoringObjectName);
                DropDownList DDLDate = (DropDownList)TCMain.FindControl("TP" + monitoringObjectName).FindControl("TCInner" + monitoringObjectName).FindControl("TPDate" + monitoringObjectName).FindControl("DDLDate" + monitoringObjectName);

                PlaceHolder placeHolderWeek = (PlaceHolder)TCMain.FindControl("TP" + monitoringObjectName).FindControl("TCInner" + monitoringObjectName).FindControl("TPWeek" + monitoringObjectName).FindControl("PHWeek" + monitoringObjectName);
                DropDownList DDLWeek = (DropDownList)TCMain.FindControl("TP" + monitoringObjectName).FindControl("TCInner" + monitoringObjectName).FindControl("TPWeek" + monitoringObjectName).FindControl("DDLWeek" + monitoringObjectName);

                ReportViewer rptViewer = new ReportViewer();
                rptViewer.Width = Unit.Pixel(1200);
                rptViewer.Height = Unit.Pixel(440);
                loadReport(rptViewer, DDLDate, monitoringObjectName, "Date");

                

                if (placeHolderDate != null)
                {
                    placeHolderDate.Controls.Add(rptViewer);
                }
                if (placeHolderWeek != null)
                {
                    placeHolderWeek.Controls.Add(rptViewer);
                }

how ever only one placeholder will be assign the ReportViewer control. In the above code only the placeHoderWeek will be assign the ReportViewer.

if I changed the last to if statement as this

if (placeHolderWeek != null)
                {
                    placeHolderWeek.Controls.Add(rptViewer);
                }
                if (placeHolderDate != null)
                {
                    placeHolderDate.Controls.Add(rptViewer);
                }

only the placeHolderDate will be assign the ReportViewer.

can anybody help me.
Thanks in advanced.