Click here to Skip to main content
14,426,824 members
Rate this:
Please Sign up or sign in to vote.
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 15-Sep-11 0:49am
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?
Rate this:
Please Sign up or sign in to vote.

Solution 1

i think removing the height field from iframe will adjust iframe to the current content(URL)
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can dynamically set Every Attribute of IFrame.

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

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

 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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100