954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Adding the same control to different Placeholder

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.

hemaljoes
Newbie Poster
13 posts since Jun 2009
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: