This is a migrated thread and some comments may be shown as answers.

youtube links

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 18 Dec 2010, 01:20 PM
I have a grid with 2 text boxes, 1 for a youtube link, the other for its description.  When I paste the link into the textbox and click the save button, I get a javascript error and the page crashes.  Heres the grid code

<telerik:GridTemplateColumn UniqueName="YouTubeLink" HeaderText="YouTube Link"  SortExpression="YouTubeLink">
                                                <ItemTemplate>
                                                    <%#DataBinder.Eval(Container.DataItem, "YouTubeLink")%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <telerik:RadTextBox ID="RadTextBoxLink" Runat="server" Skin="Vista" Width="400px" MaxLength="2000" TextMode="MultiLine" Rows="10">
                                                    </telerik:RadTextBox>
                                                </EditItemTemplate>
                                            </telerik:GridTemplateColumn>
 and this is the link im trying to save

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/xT4Kw3A0pHI?fs=1&;hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xT4Kw3A0pHI?fs=1&;hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

Im basically setting up a data entry screen where users can save various youtube links for subsequent display on their website, surely this is possible ?  Can anyone help me out ?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Dec 2010, 11:31 AM
Hello,

This is a general error (not directly related to our controls) that is caused by the fact that you are trying to save HTML code in the DB. You have two options:

1) Disable the request validation (not recommended)
<%@ Page Language="C#" ValidateRequest="false" %>

2) Manually encode the HTML code:
HttpUtility.HtmlEncode(myhtmlcode)

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or