D
David
Hi all,
I have spent ages trying to work this out... I have searched google for ages
with different search criteria, tried various methods, all to no avail.
I am dynamically placing user control onto the page. Now, the page has a
"Text Only" link, so I have to modify the output of the user control to
remove any graphics.
I think I can do this with a usercontrol that doesn't have any form
elements, but as soon as a form item is met, I get an error that the element
must be inside a form tag.
I have...
System.Text.StringBuilder SB = new System.Text.StringBuilder();
System.IO.StringWriter SW = new System.IO.StringWriter(SB);
HtmlTextWriter UCText = new HtmlTextWriter(SW);
Control myForm = Page.FindControl("Form1");
Control myControl = Page.LoadControl(ResolveUrl("~" +
post.CustomProperties["ApplicationName"].Value));
//myForm.Controls.Add(myControl);
//myControl.RenderControl(UCText);
UCPH.Controls.Add(myControl);
UCPH.RenderControl(UCText);
UCPH.Controls.Clear();
UCPH.Controls.Add(new LiteralControl(SB.ToString()));
No matter which way I try it, it always breaks on the RenderControl.
I have to get this working. I don't mind wether it is in the UserControl
itself, or on the outside of the control.
All help is appreciated.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
I have spent ages trying to work this out... I have searched google for ages
with different search criteria, tried various methods, all to no avail.
I am dynamically placing user control onto the page. Now, the page has a
"Text Only" link, so I have to modify the output of the user control to
remove any graphics.
I think I can do this with a usercontrol that doesn't have any form
elements, but as soon as a form item is met, I get an error that the element
must be inside a form tag.
I have...
System.Text.StringBuilder SB = new System.Text.StringBuilder();
System.IO.StringWriter SW = new System.IO.StringWriter(SB);
HtmlTextWriter UCText = new HtmlTextWriter(SW);
Control myForm = Page.FindControl("Form1");
Control myControl = Page.LoadControl(ResolveUrl("~" +
post.CustomProperties["ApplicationName"].Value));
//myForm.Controls.Add(myControl);
//myControl.RenderControl(UCText);
UCPH.Controls.Add(myControl);
UCPH.RenderControl(UCText);
UCPH.Controls.Clear();
UCPH.Controls.Add(new LiteralControl(SB.ToString()));
No matter which way I try it, it always breaks on the RenderControl.
I have to get this working. I don't mind wether it is in the UserControl
itself, or on the outside of the control.
All help is appreciated.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available