List Info

Thread: C-Sharp (C#) Group: Re: How to get HTML presentation of WebControl at the server side?




C-Sharp (C#) Group: Re: How to get HTML presentation of WebControl at the server side?
user name
2006-07-06 14:44:47
Sorry I'm responding so late. I'm guessing that you have
your issue
handled by now, but I am just curious as to whether you need
the same
control instances you have on the page already, or if you
simply need
server controls to kick back their rendered code to you. If
the former,
then I would have to dig a bit deeper, as I know I've done
it for work
before, but that was some time back. If the latter, you
should have no
problem implementing the following...
---
StringBuilder sb = new StringBuilder();
TextBox tb1 = new TextBox();
HtmlTextWriter htw = new HtmlTextWriter(new
StringWriter(sb));
tb1.RenderControl(htw);
string res = sb.ToString();
---
Anyway, I'm again sorry that I couldn't get back to you
closer to your
post, but I'm not trying to play catch-up so to speak. I
hope what's
there does something for someone.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: How to get HTML presentation of WebControl at the server side?
user name
2006-07-07 15:02:04

Lance May написав:
> Sorry I'm responding so late. I'm guessing that you
have your issue
> handled by now, but I am just curious as to whether you
need the same
> control instances you have on the page already, or if
you simply need
> server controls to kick back their rendered code to
you. If the former,
> then I would have to dig a bit deeper, as I know I've
done it for work
> before, but that was some time back. If the latter, you
should have no
> problem implementing the following...
> ---
> StringBuilder sb = new StringBuilder();
> TextBox tb1 = new TextBox();
> HtmlTextWriter htw = new HtmlTextWriter(new
StringWriter(sb));
> tb1.RenderControl(htw);
> string res = sb.ToString();
> ---
> Anyway, I'm again sorry that I couldn't get back to
you closer to your
> post, but I'm not trying to play catch-up so to speak.
I hope what's
> there does something for someone.

No need to excuse.
That's just the point that I need to get HTML presentation
of the
control that is placed on the form.
VerifyRenderingInServerForm method
of the Page is called every time the control is rendered and
it throws
exception while control is rendering out of the form. I
don't post the
solution I found because it is somewhat complicate and
somewhat not
good-looking to exemplify.
Email me if anybody needs it.
Sorry for my English.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )