Java script breaks layout edit functionality
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
>
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