Java script breaks layout edit functionality

Posted by Community Admin on 04-Aug-2018 18:20

Java script breaks layout edit functionality

All Replies

Posted by Community Admin on 21-Nov-2011 00:00

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.

Posted by Community Admin on 24-Nov-2011 00:00

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

This thread is closed