Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Saturday, March 24, 2012

Text to System.Web.UI.Control

Hi NG!

Is there a function in the .net FX that returns a
System.Web.UI.Control's inherited class for a specified text?
Means, if you specify

<a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
Corporation</a
it should return an instance of System.Web.UI.HtmlAnchor or
System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
are set appropriately.

Thanks for any hint!

Best regards,

MichaelThere's nothing in .Net to do this...there might be third party tools
though...couldn't quickly find anything..

Karl

"Michael Kremser" <mkspamx-usenet@.yahoo.de> wrote in message
news:%23Q2L26rkEHA.3432@.TK2MSFTNGP14.phx.gbl...
> Hi NG!
> Is there a function in the .net FX that returns a
> System.Web.UI.Control's inherited class for a specified text?
> Means, if you specify
> <a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
> Corporation</a>
> it should return an instance of System.Web.UI.HtmlAnchor or
> System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
> are set appropriately.
> Thanks for any hint!
> Best regards,
> Michael
Note, that in you example you don't have a server-side control in the first
place since there is no runat=server attribute.

Eliyahu

"Michael Kremser" <mkspamx-usenet@.yahoo.de> wrote in message
news:%23Q2L26rkEHA.3432@.TK2MSFTNGP14.phx.gbl...
> Hi NG!
> Is there a function in the .net FX that returns a
> System.Web.UI.Control's inherited class for a specified text?
> Means, if you specify
> <a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
> Corporation</a>
> it should return an instance of System.Web.UI.HtmlAnchor or
> System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
> are set appropriately.
> Thanks for any hint!
> Best regards,
> Michael

Text to System.Web.UI.Control

Hi NG!
Is there a function in the .net FX that returns a
System.Web.UI.Control's inherited class for a specified text?
Means, if you specify
<a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
Corporation</a>
it should return an instance of System.Web.UI.HtmlAnchor or
System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
are set appropriately.
Thanks for any hint!
Best regards,
MichaelThere's nothing in .Net to do this...there might be third party tools
though...couldn't quickly find anything..
Karl
"Michael Kremser" <mkspamx-usenet@.yahoo.de> wrote in message
news:%23Q2L26rkEHA.3432@.TK2MSFTNGP14.phx.gbl...
> Hi NG!
> Is there a function in the .net FX that returns a
> System.Web.UI.Control's inherited class for a specified text?
> Means, if you specify
> <a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
> Corporation</a>
> it should return an instance of System.Web.UI.HtmlAnchor or
> System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
> are set appropriately.
> Thanks for any hint!
> Best regards,
> Michael
Note, that in you example you don't have a server-side control in the first
place since there is no runat=server attribute.
Eliyahu
"Michael Kremser" <mkspamx-usenet@.yahoo.de> wrote in message
news:%23Q2L26rkEHA.3432@.TK2MSFTNGP14.phx.gbl...
> Hi NG!
> Is there a function in the .net FX that returns a
> System.Web.UI.Control's inherited class for a specified text?
> Means, if you specify
> <a href="http://links.10026.com/?link=http://www.microsoft.com/" title="Microsoft">Microsoft
> Corporation</a>
> it should return an instance of System.Web.UI.HtmlAnchor or
> System.Web.UI.WebControls.LinkButton, where Href, Title, and InnerText
> are set appropriately.
> Thanks for any hint!
> Best regards,
> Michael

Thursday, March 22, 2012

textarea viewstate formatting

Hello.

What I am trying to do is implement a "preview" function that displays all of the html typed within a textarea onto a webpage with HTML intact. I am using the viewstate to preserve the contents of the textarea. However, I find that doing this replaces all "<" with "<", ">" with ">". As a result, the preview does not render any HTML.

It appears that viewstate with asp.net automatically converts the chars, perhaps as insurance to "sterilize" malicious script. Can someone confirm this?

Is there a way to prevent it from converting the carat characters for the viewState preservation? Or is it a fact of life that I'll need to manually convert them back?

Thanks,
walla118Thanks niceguy.

I just realized that HtmlDecode would work for my purposes. And your idea about using javascript to display preview might be a good way to go!

Thanks again.
Hi walla118,

Have you tried using:


HttpContext.Current.Server.HtmlEncode
HttpContext.Current.Server.HtmlDecode

These may help...?

I found that it is easier to open a pop-up using javascript for a "preview" rather than doing it server side...just a thought.

Hope this helps!

Jason