0

I need to display dynamic created html in aspx(server side html); I tried to use Iframe but it will not displaying anything ; it will not work because of security reasons ; Is there is any controls that will display html page? Dynamic html have its on css and javascripts so I can’t use html text box controls. If anyone have solution please help Thanks

1
  • <div> can be used to show the html. Commented May 1, 2012 at 11:52

3 Answers 3

1

Since your dynamic page has its own CSS & Javascript, I'm assuming it's not written to coexist with its host page. I'm also assuming that when you tried to use the iFrame you just tried to write straight to it from the containing page.

I would suggest moving your code that generates the HTML to a separate ASPX page and referencing that page as the source of your iFrame or rewriting your CSS & Javascript so it will coexist and using a DIV.

Also, it's sort of hard to come up with a workable solution without you showing some of the code you have currently.

Sign up to request clarification or add additional context in comments.

1 Comment

i am converting a word file as html and saving in a server folder; i want to display this; converted html have its on CSS that is my problem; if i display this in a html editing control it will change style; i want to maintain style; i want to show this html as read only but user can select text; i need to process with this selected content;
0

Have a look at the

<asp:Literal> 

control. There's an example here: Set ASP Literal text with Javascript

-- EDITED 03/05/2012 --

Simple example of an asp.net literal control in action:

.aspx code

<asp:Literal ID="MyLiteral" runat="server" /> 

.vb code behind

Dim k As String k = "<table style=""border: 1px solid red;""><tr><td>Cell 1</td></tr><tr><td>Cell 2</td></tr></table>" MyLiteral.Text = k 

If I compile this in VS2008 I get a two row table with a red border in IE.

3 Comments

I'm not psychic - what's not working. What have you tried to do. Post some examples.
server side Server side code ` string file = @"F:\myHTML.html"; StreamReader sr; FileInfo fi = new FileInfo(file); string input = ""; if (File.Exists(file)) { sr = File.OpenText(file); input += Server.HtmlEncode(sr.ReadToEnd()); sr.Close(); } input += "</pre>"; MyHtmlCtrl.Text = input; ` Aspx code <asp:Literal ID="MyHtmlCtrl" runat="server"></asp:Literal> this is displaying html code as out put
I've edited my answer to add a simple example of how an asp.net literal works. Not quite sure why yours isn't working because your code looks good - something wrong with the way the HTML is being read from the file? If you post the contents I will have a look.
0

I found the answer!! Use UFRAME!! It's simple and easy!! uframe.codeplex.com

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.