Friday, February 02, 2007

ASP.NET Frames

How to use iFrames in Asp.net??


1. place your iframe tag where your want in body tag for eg

<iframe id="frame1" style="HEIGHT: 150px" border="0" name="frame1" align="middle" frameBorder="no" width="100%" scrolling="no" runat="server"</iframe>


2. Now, declare one Htmlgeneric control like this

protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;


3. At last ....

HtmlControl frame1 = (HtmlControl)this.FindControl("frame1");
frame1.Attributes["src"] ="target.aspx".ToString ();


write this in your application page load function.........

2 comments:

Anonymous said...

Thank you for the post :)

NayiVacancy said...

thanks