On Wed, 13 Jul 2005 10:07:10 +0100, David wrote:
> I guess this is a difficult one to answer...
>
> I had a thought about it though. Rather than trying to edit the rendered
> usercontrol, I could render the final output page. Maybe this will be an
> easier question to answer.
>
> Once the page has been built up, how do I then edit the output before it
> being sent to the browser? I have to make a text only page, so removing all
> the image tags.
>
> If this is still too difficult, then how about a piece of code that will
> cycle through all the controls in a user control, if it finds any image
> controls, remove them. (visible=false). This still leaves me with one other
> issue, if I use the plain HTML image control (or input type image) that is
> not runat=server, that will likely get left on. I need to remove all.
>
> Best regards,
> Dave Colliver.
>
http://www.LeicesterFOCUS.com > ~~
>
http://www.FOCUSPortals.com - Local franchises available
>
>
> "David" <david.colliver.NEWS@revilloc.REMOVETHIS.com> wrote in message
> news:ez9CApkgFHA.2700@TK2MSFTNGP15.phx.gbl...
>> 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
>>
1 I woould write the Response and htmlt a buffer.
2. I write ths stuff useing XHTML.
3. Before you are ready to render, make your transformations ad required