Words like
Now i am giving the same task more dynamically and here is the given scenario.
are not a good choice though
anyways that's how you can use a repeater
Your aspx page
<div>
<asp:Repeater ID="Repeat1" runat="server">
<HeaderTemplate>
<table class="tblcolor">
<tr>
<td>Name
</td>
<td>Video
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#DataBinder.Eval(Container.DataItem,"Name")%>
</td>
<td>
<%# "<iframe id='Video' width='450' height='350' src='" + DataBinder.Eval(Container.DataItem, "Url") + "' allowfullscreen></iframe>" %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
Your code behind page
public class NameVideo
{
public string Name { get; set; }
public string Url { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
var data = new List<NameVideo>()
{
new NameVideo(){Name="Video1", Url ="https://www.youtube.com/embed/9bi9eDZUJPQ" },
new NameVideo(){Name="Video2", Url= "https://www.youtube.com/embed/Zx-JcXsbUqQ"}
};
Repeat1.DataSource = data;
Repeat1.DataBind();
}