Render data instead of link in iframe

In iframe we always render some other page like

<iframe runat="server" id="myIframe" src="http://www.shahvaibhav.com"></iframe>

or via code behind (I am using c# as code behind)

myIframe.Attributes["src"] = "http://www.shahvaibhav.com"

But what if I want to add some html content instead of page in iframe?

iframe has attribute “srcdoc” which can be used to show some html content

<iframe runat="server" id="myIframe" srcdoc="<h1>www.shahvaibhav.com</h1>"></iframe>

or in code behind

myIframe.Attributes["srcdoc"] = "<h1>www.shahvaibhav.com</h1>"

admin