Click here to Skip to main content
15,868,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am developing a site in which youtube video’s will be added to asp.net page using the <iframe> HTML code given at youtube.com site. When I run the program, in the web page youtube video is displayed. But the strange thing is when I move mouse over the video display area the page postbacks happens. I am able to find this when I run the program in debug mode.

To exactly reproduce the scenario, I am writing the steps which I have done in my project.

1) In visula studio 2010 > Open asp.net web application project (with c# as language)
2) add some page, say cat.aspx
3) in cat.aspx write the code as below

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

<asp:ScriptManager ID="ScriptManager1" runat="server">

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<asp:Label ID="lblVideo" runat="server">



</form>

4) in cat.aspx.cs, in page_load even write the following line

lblVideo.Text = "<iframe width=\"620\" height=\"349\" src=\"http://www.youtube.com/embed/WoTsE7pbuKg\" frameborder=\"0\" allowfullscreen></iframe>";

5)you can replace the above <iframe string with any other video's <iframe> given by youtube.com, but be sure to set "http:" and escape " with \" as how I have done.(to get <iframe> HTML code for any youtube video, visit www.youtube.com, click on any video or a famous song, below the video a menu "share" will be displayed, click on it, then another option "Embed" will be displayed, click on it, you will be presented with <iframe> code)

6)Now run your web app project, you can see, youtube video is displayed.

7)Now run with break point set in Page_load event, now move mouse over the video display area, you can see for each time the mouse enters the video display area, a postback happens.

8) I have latest flash installed in firefox and InternetExplorer, this problem happens only in firefox and IE, not in chrome. And this problem happens only when we use Updatepanel. I also found that page does not postback (IsPostBack) is false, every time the control hits the codebehind. It is like page is requested for the first time as how we type the url in the address bar and press enter

Many Thanks in advance to anybody who try to help or give solution.</iframe>
Posted
Updated 6-Aug-13 6:49am
v3
Comments
TryAndSucceed 6-Aug-13 15:00pm    
I think its trying to reach YouTube in-case you want to Pause or Replay. I think its Youtube's functionality.
ManiInAction 7-Aug-13 6:18am    
Hi, thanks for your comments, yes it tries to reach youtube, so that only a picture is displayed, why it is hitting page_load event of my aspx.cs page, it shouldnt happen right?

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