Link to home
Start Free TrialLog in
Avatar of chrispaton
chrispaton

asked on

Registering UserControl in codebehind receives parser error exception on calendar click

I have a control registered on a page using;

<%@ Register Src="~/Controls/33pd.ascx" TagName="pd" TagPrefix="pd3" %> at the top of the page and
<pd3:pd id="pd" runat="server"></pd3:pd> where I need the control to be displayed

Which all works fine and no issues the control includes a grid view and tabconatiners displaying data and another control with a asp:calendar displaying data from a database inside an updatepanel.

I need to be able to add the 33pd.ascx control dynamically from the codebehind so I can display different versions of the 33pd.ascx.

I have this code which displays the different controls and loads the controls on the page;
            Control uc = null;

                if (dsPropCheck.Tables[0].Rows[0]["Source"].ToString() == "33")
                {
                    uc = Page.LoadControl(Request.ApplicationPath + "/Controls/33pd.ascx");
                }
                    else if (dsPropCheck.Tables[0].Rows[0]["Source"].ToString() == "22")
                    {
                        uc = Page.LoadControl(Request.ApplicationPath + "/Controls/22pd.ascx");
                    }
                    else if (dsPropCheck.Tables[0].Rows[0]["Source"].ToString() == "11")
                    {
                        uc = Page.LoadControl(Request.ApplicationPath + "/Controls/11pd.ascx");
                    }
             PHPD.Controls.Add(uc);

on page placeholder;
    <asp:PlaceHolder ID="PHPD" runat="server"></asp:PlaceHolder>

but when I click to intereact with the calendar I get this error;

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2; .NET4.0C)
Timestamp: Sun, 8 May 2011 11:20:30 UTC


Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.


ASKER CERTIFIED SOLUTION
Avatar of b_levitt
b_levitt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chrispaton
chrispaton

ASKER

The Fiddler tool was a useful tool to use/suggest for the problem but this did not highlight any issues relating to the problem and found the solution to the problem myself with some more checks after eliminating that all the elements on the page were loading using the tool suggested