tags:

views:

147

answers:

1

Hi I want to pass an object as iframe src. Is it possible?

like this

StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();

myiframe.Attributes.Add("src", s);

Thank you, Nagu

A: 

no, you can't set any value other then a url to iframe's source (src) attribute.

But if the text you want to set contains html content you can add it into a placeholder instead.

EDIT : I think you're using ASP.NET, and assume that you have a placeholder in your asp.net page like that :

<asp:PlaceHolder runat="server" ID="phContent"></asp:PlaceHolder>

you can set your content at code behind inside this placeholder like that :

StreamReader reader = new StreamReader(data);
string htmlContent = reader.ReadToEnd();

phContent.Controls.Add(new LiteralControl(htmlContent));
Canavar
can you give me a simple example
Nagu