Hi,
I used this sample http://demos.telerik.com/aspnet-ajax/editor/examples/customdialogs/defaultcs.aspx to get a Custom Dialog for the Editor. On that Dialog page I added a RadButton. This RadButton has a OnClientClicked Event with a Javascript function (Dialog return). The Problem is that this function gets fired on PageLoad (Dialog\RadWindow). If i use a normal ASP Button with "OnClientClick" all works fine. How is it possible to have the JavaScript function fired only on the Click event with a RadButton.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dialog.aspx.cs" Inherits="TelerikSample.Dialog" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
</Scripts>
</telerik:RadScriptManager>
<div>
<telerik:RadButton ID="RadButton1" runat="server" Text="RadButton" OnClientClicked="insertLink('IdOfList')"></telerik:RadButton>
<%--<asp:Button ID="Button2" runat="server" Text="ASPButton" OnClientClick="insertLink('IdOfList')" ></asp:Button>--%>
</div>
</form>
</body>
</html>
<script type="text/javascript">
function getRadWindow() {
if (window.radWindow) {
return window.radWindow;
}
if (window.frameElement && window.frameElement.radWindow) {
return window.frameElement.radWindow;
}
return null;
}
function insertLink(Id) //fires when the Insert Link button is clicked
{
getRadWindow().close(Id); //use the close function of the getRadWindow to close the dialog and pass the arguments from the dialog to the callback function on the main page.
}
</script>
Thanks,
Hermann
I used this sample http://demos.telerik.com/aspnet-ajax/editor/examples/customdialogs/defaultcs.aspx to get a Custom Dialog for the Editor. On that Dialog page I added a RadButton. This RadButton has a OnClientClicked Event with a Javascript function (Dialog return). The Problem is that this function gets fired on PageLoad (Dialog\RadWindow). If i use a normal ASP Button with "OnClientClick" all works fine. How is it possible to have the JavaScript function fired only on the Click event with a RadButton.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dialog.aspx.cs" Inherits="TelerikSample.Dialog" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
</Scripts>
</telerik:RadScriptManager>
<div>
<telerik:RadButton ID="RadButton1" runat="server" Text="RadButton" OnClientClicked="insertLink('IdOfList')"></telerik:RadButton>
<%--<asp:Button ID="Button2" runat="server" Text="ASPButton" OnClientClick="insertLink('IdOfList')" ></asp:Button>--%>
</div>
</form>
</body>
</html>
<script type="text/javascript">
function getRadWindow() {
if (window.radWindow) {
return window.radWindow;
}
if (window.frameElement && window.frameElement.radWindow) {
return window.frameElement.radWindow;
}
return null;
}
function insertLink(Id) //fires when the Insert Link button is clicked
{
getRadWindow().close(Id); //use the close function of the getRadWindow to close the dialog and pass the arguments from the dialog to the callback function on the main page.
}
</script>
Thanks,
Hermann