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].Row s[0]["Sour ce"].ToStr ing() == "33")
{
uc = Page.LoadControl(Request.A pplication Path + "/Controls/33pd.ascx");
}
else if (dsPropCheck.Tables[0].Row s[0]["Sour ce"].ToStr ing() == "22")
{
uc = Page.LoadControl(Request.A pplication Path + "/Controls/22pd.ascx");
}
else if (dsPropCheck.Tables[0].Row s[0]["Sour ce"].ToStr ing() == "11")
{
uc = Page.LoadControl(Request.A pplication Path + "/Controls/11pd.ascx");
}
PHPD.Controls.Add(uc);
on page placeholder;
<asp:PlaceHolder ID="PHPD" runat="server"></asp:Place Holder>
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.PageRequestMa nagerParse rErrorExce ption: 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'.
<%@ Register Src="~/Controls/33pd.ascx"
<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].Row
{
uc = Page.LoadControl(Request.A
}
else if (dsPropCheck.Tables[0].Row
{
uc = Page.LoadControl(Request.A
}
else if (dsPropCheck.Tables[0].Row
{
uc = Page.LoadControl(Request.A
}
PHPD.Controls.Add(uc);
on page placeholder;
<asp:PlaceHolder ID="PHPD" runat="server"></asp:Place
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.PageRequestMa
Details: Error parsing near '
<!DOCTYPE html PUB'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER