Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project i am loading a URL in an IFrame. I want to resize the IFrame height to match that of the loaded content without needing to scroll.

This URL is coming from a webservice method that contains data.

how can I achieve this?

can anybody help me?

thanks,

Pappu
Posted
Updated 14-Sep-11 23:49pm
v2
Comments
jim lahey 15-Sep-11 5:50am    
Improved spelling, grammar
PappuKumarMishra 16-Sep-11 0:31am    
okay i will improved it..but any way did you understand my question?

i think removing the height field from iframe will adjust iframe to the current content(URL)
 
Share this answer
 
You can dynamically set Every Attribute of IFrame.

C#
<iframe id="Image1" runat="server"></iframe>

And on the code behind you can set attribute as shown below

C#
 protected void Page_Load(object sender, EventArgs e)
    {
Image1.Attributes.Add("height", "150px");
Image1.Attributes.Add("width", "150px");
Image1.Attributes.Add("scrolling", "no");
Image1.Attributes.Add("frameborder", "0");
    }

if this Answer is usefull for you then please vote
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900