Using IFRAME in ASP.NET

by Vishwa 2. October 2010 18:13

If you are using an IFRAME in ASP.NET and setting the height and width and not working as per your need. Spent couple of hours trying all possible options and found a very easy solution

1. Remove following line from Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2. How to Set values Dynamically

<iframe id="Testframe" runat="Server" />

<script language="vb" runat="server">

 
Protected WithEvents frame1 As System.Web.UI.HtmlControls.HtmlGenericControl
  
  Sub Page_Load()
      Dim frame1 As HtmlControl = CType(Me.FindControl("TestFrame"), HtmlControl)
      With frame1
          .Attributes("src") = "TestPage.aspx"
          .Attributes("width") = "100%"
          .Attributes("height") = "100%"
      End With
      
  End Sub
 
</script>

Tags:

.NET

Comments are closed

About Me

Me Hello,my name is
Vishwa Mohan Kumar, PMP
MCP SOA Certified Architect
I am a Software Architect. This blog is result of my experiments.

Flickr Photos

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Archive

Recent Comments

Comment RSS

Live Traffic Feed