Y ) IFrame
IFrame
:- Iframe Property is 0
Iframe Simple View Video in Ifrme Tag
Source Code :- IframeSimple.Aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Z3_iframm(simple).aspx.cs" Inherits="INFRAME" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 285px;
height: 82px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
HOW to use iframe in dotnet<br />
<br />
frame border property 0<br />
<br />
<br />
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Anormalpage(insert,upd,del,find).aspx" Target="f1">Page1</asp:HyperLink>
<br />
<br />
<iframe name="f1" frameborder="0" class="auto-style1"> </iframe>
<br />
<iframe width="560" height="315" src="https://www.youtube.com/embed/L0kgz2fHn_s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"></iframe>
</div> <%--https://www.youtube.com/embed/ <eval ("column name")L0kgz2fHn_s--%>
</form>
</body>
</html>
No Button Source Code
2 ) Source Code :- Iframeupload.Aspx
Show data In Gridview And DataList
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Z3ass_Ifamerupload.aspx.cs" Inherits="ZZZIfamerupload" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
font-size: large;
color: #FF0000;
}
.auto-style2 {
color: #FF0000;
font-size: x-large;
}
.auto-style3 {
text-align: center;
}
.auto-style4 {
text-align: left;
}
.auto-style5 {
color: #000000;
font-size: x-large;
}
.auto-style6 {
color: #FFCC99;
}
.auto-style7 {
color: #000000;
background-color: #FFFFFF;
}
.auto-style8 {
background-color: #FFFFFF;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="auto-style3">
<div class="auto-style4">
<strong><span class="auto-style2"> <h1> </span> <span class="auto-style5">*</span><span class="auto-style2"> Ifame :- Youtube Video Url Upload And Binding </span><span class="auto-style5">*</span></strong></h1>
<br />
<br />
<strong>Video</strong> <span class="auto-style6"> </span><span class="auto-style7"><strong>Name </strong></span><strong>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</strong>
<br />
<br class="auto-style8" />
<span class="auto-style8"> <strong>Video</strong> <strong>Url </strong></span><strong>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</strong>
<br />
<br class="auto-style8" />
<span class="auto-style8"> </span>
<asp:Button ID="Button1" runat="server" Height="40px" OnClick="Button1_Click" Text="Submit" Width="75px" CssClass="auto-style8" />
<span class="auto-style8">
</span>
<br />
<br />
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Height="16px" Width="711px" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black">
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" text='<%# Eval("name") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Url">
<ItemTemplate>
<iframe width="250" height="200" src="https://www.youtube.com/embed/<%# Eval("url") %>" frameborder="0"></iframe>
</ItemTemplate> <%--https://www.youtube.com/embed/ <eval ("column name")L0kgz2fHn_s--%>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#808080" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
<br />
<strong><span class="auto-style1"> DataList </span></strong>
<br />
<br />
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" Height="545px" Width="994px">
<ItemTemplate>
<b>Name</b>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("name") %>'></asp:Label>
<br />
<iframe width="250" height="200" src="https://www.youtube.com/embed/<%# Eval("url") %>" frameborder="0"></iframe>
</ItemTemplate>
</asp:DataList>
<br />
<br />
</div>
</form>
</body>
</html>
Button Code :- Iframeupload.Aspx.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
public partial class ZZZIfamerupload : System.Web.UI.Page
{
SqlConnection cn;
SqlCommand cm;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
show();
showdetail();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string path = ConfigurationManager.AppSettings["db1"];
cn = new SqlConnection(path);
cn.Open();
string k = "insert into videotwcolum(name,url)values(@name1,@url1)";
cm = new SqlCommand(k, cn);
cm.Parameters.AddWithValue("name1", TextBox1.Text);
cm.Parameters.AddWithValue("url1", TextBox2.Text);
cm.ExecuteNonQuery();
Response.Write("data submited succesfully");
}
protected void show()
{
string path = ConfigurationManager.AppSettings["db1"];
cn = new SqlConnection(path);
cn.Open();
string k = "select * from videotwcolum";
cm = new SqlCommand(k, cn);
dr = cm.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
dr.Close();
}
protected void showdetail()
{
string path = ConfigurationManager.AppSettings["db1"];
cn = new SqlConnection(path);
cn.Open();
string k = "select * from videotwcolum";
cm = new SqlCommand(k, cn);
dr = cm.ExecuteReader();
DataList1.DataSource = dr;
DataList1.DataBind();
dr.Close();
}
}
Comments
Post a Comment