Monday, 28 June 2021

How To Call Page In iframe In Asp net

6/28/2021 - By Pranav Singh 0

In this article i will show you how you can set how you can dynamically set the iframe src in your asp.net application using c#.net.  In this first we will create a new asp.net application and add a web page. In this webpage we will add and iframe and add server tag which Is runat=”server”.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" 

Inherits="WebApplicationTest.WebForm1" %>

 

<!DOCTYPE html>

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

       <title></title>

</head>

<body>

       <form id="form1" runat="server">

        <div>

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

        </div>

       </form>

</body>

</html>


Please check the above code above highlighted piece of code. Now this iframe control is accessible on server side code of your application.

Now add a new page which we will display in iframe.  Here is the test page.

How To Set iframe src Dynamically in Asp.Net C#


 Now we will write code to access the test page and display it on iframe control.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

namespace WebApplicationTest

{

       public partial class WebForm1 : System.Web.UI.Page

       {

        protected void Page_Load(object sender, EventArgs e)

        {

            ifrDisplay.Src = "TestPage.aspx";

        }

       }

}

 

Now we have done run the application and check the output.

Tags: ,
About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top