1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Java script breaks layout edit functionality

Java script breaks layout edit functionality

2 posts, 0 answered
  1. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    21 Nov 2011
    Link to this post
    Hello,

    I have custom widget with some java script in it.
    if I will uncomment following line:
    <telerik:RadCodeBlock ID="CodeBlock" runat="server">  
        <script type="text/javascript">
            //window.$ = $telerik.$;
            function OnSendBtn(sender, eventArgs) {
                if (eventArgs.get_eventTarget() == "<%# SendBtn.UniqueID %>") {
                    var btn = eventArgs.get_eventTargetElement();
                    $telerik.$('#' + btn.id).fadeOut();
                }
            }
        </script>
    </telerik:RadCodeBlock>

    it breaks layout edit functionality (when editing page and clicking "edit" on block). It doesn't show layout editing elements in the block and on the right side sitefinity panel.

    Thanks,
    Denis.
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Aug 2017
    24 Nov 2011
    Link to this post
    Hello Denis,

    The problem is a jQuery script conflict because Sitefinity backend also uses lots of Jquery and $telerik. To avoid the problem use jQuery.noConflict() or disable the control when you are in page edit mode. Put a new if statement to determine if the control is in design mode
    public partial class WebUserControl2 : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (this.IsDesignMode())
                {
                 //hide it here
                }
     
            }
        }


    Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered