1
Reply

How to assign HTML content to iframe control from asp.net codebehind ?

Pramod Kumar Nandagiri

Pramod Kumar Nandagiri

Mar 16 2012 10:36 AM
5.4k
Hi,

 <iframe id="myIframe" runat="server" ></iframe>

I want to assign the html content to iframe control from asp.net code behind page;

this is working fine
myIframe.Attributes.Add("src", "pathtofilewith.html");
but, i don't want to give the path of html file to display i just want to assign some html content which comes from database to iframe control.

i want some thing like this(<html>pramod</html>) to be displayed in iframe control

i tried the bellow ways but nothing is succesful

1)   myIframe.Attributes["innerHTML"] = "<h1>Thank You..</h1>";

2)   myIframe.Attributes.Add("innerHTML", "<h1>Pramod Nandagiri</h1>");


Answers (1)