Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to save the embed code for a video in the database. The layout I have is as follows:

XML
<asp:TextBox ID="txtVideoThumbnailURL" placeholder="Video Thumbnail URL" runat="server" /><br />
                <asp:TextBox ID="txtVideoURL" placeholder="Video Url" runat="server" />
                <asp:Button ID="bntAddVideo" runat="server" Text="Add Video" OnClick="btnAddVideo_Click" />


If I add random text into the Video URL box it works fine, but as soon as I try save the embed code it doesnt event go back to the server. Here is an example of embed code:

<object style="height: 390px; width: 640px"><embed src="http://www.youtube.com/v/1sujhF102Uw?version=3&feature=player_detailpage" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></object>

Any advice?
Posted
Comments
Orcun Iyigun 27-Dec-11 19:28pm    
Have you escaped the quotes? Are you using parameterized query while inserting it to the database? Have you checked if it exceed the fields charecter count or not?
DominicZA 27-Dec-11 19:36pm    
It is not firing the buttons clicked event! If I place a break point in the code behind file it never gets hit
Orcun Iyigun 27-Dec-11 19:57pm    
Event not firing happens .. only if the button is dynamic(in your occasion it seems not). or you have bind the control onPostback once again .. eg.. RowCommand will not fire if you rebind the gridview after postback ..
Also sometimes VS will act wierd, so try to Remove that Button in your FORM then grab another Button from the ToolBox then Double Click on the Button to generate the event handler for you.Then run your codes and see what will happen..


DominicZA 27-Dec-11 20:36pm    
The event fires if I put in random garbage so its not a VS issue.

1 solution

If you need to accept raw HTML on your form you must set the ValidateRequest property of the page directive to false. Be warned though this will allow all HTML, including anything nasty anyone can think of, to be uploaded from that page. You should use it with caution
 
Share this answer
 
Comments
DominicZA 27-Dec-11 22:16pm    
I know about this, and I know the trouble that it can cause, this is why i was hoping for an alternative :(
[no name] 27-Dec-11 23:14pm    
You should have stated this in your question instead of wasting our time giving you solutions you already know about.
thatraja 27-Dec-11 23:22pm    
5! for your wasted time

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