Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Pls some one tell that how to bind iframe dynamically in repeater control in asp.net c#
i uses the code in repeater is
<iframe id="iframe1" src="<%#Eval("video") %>" runat="server" width='640' height='390'></iframe>
and the code behind is
C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           repeter_bind();
       }
   }
   private void repeter_bind()
   {

           string sql = "select * from tbl_blog order by blog_ins_date desc ";
           cq.run_repeater(sql, repeter_blog);
        //   iframe1.Attributes["src"] =




   }



but after adding iframe in repeater control it shows that server tag is not well formed.
Pls some one tell that how to bind iframe dynamically in repeater control from the database and in the colum ther is a link for the video.
http://www.youtube.com/embed/oqhk3UEsK48

Pls some one tell that how to solve this problem
Posted

Instead of
src="<%#Eval("video") %>"

Try:
src="<%#Eval('video') %>"
 
Share this answer
 
You can do like that
Step 1. Create a method that return full path src attribute of iframe
C#
public string GetUrl(string id)
        {
            // You can change the value of url as your own.
            return "../../abc/xyz.aspx?Id =" + id;
        }


Step 2. Define Ifranme and pass your id to generate url.

ASP.NET
<iframe style=" width: 450px; height: 400px;" id="irm1" src='<%#GetUrl(Eval("Id").ToString()) %>' runat="server"></iframe>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900