I followed the documentation on using the radtooltip with a standard asp
validation summary and standard asp button as per on page:
http://demos.telerik.com/aspnet-ajax/tooltip/examples/clientsideapi/defaultcs.aspx
And successfully got this working, but when I tried to use a radbutton instead of a standard asp button I get a microsoft JScript runtime error: Object Expected
Below is my code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="nomastervaltest.aspx.vb"
Inherits="nomastervaltest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<script type="text/javascript">
//<![CDATA[
function HideTooltip() {
var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
if (tooltip) tooltip.hide();
}
function ShowTooltip() {
window.setTimeout(function () {
var tooltip = $find("RadToolTip1");
//API: show the tooltip
tooltip.show();
}, 10);
}
function CheckIfShow(sender, args) {
var summaryElem = document.getElementById("ValidationSummary1");
//check if summary is visible
if (summaryElem.style.display == "none") {
//API: if there are no errors, do not show the tooltip
args.set_cancel(true);
}
}
//]]>
</script>
<asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvCompany" runat="server" ControlToValidate="txtCompany"
Text="!" ErrorMessage="The company name is obligatory!">
</asp:RequiredFieldValidator>
<telerik:RadButton ID="btnSubmit" Text="Submit" runat="server" OnClientClicking="ShowTooltip()">
</telerik:RadButton>
<telerik:RadToolTip runat="server" ID="RadToolTip1" Position="TopRight" HideEvent="ManualClose"
ShowEvent="FromCode" Width="300px" RelativeTo="Element" EnableShadow="true" OnClientBeforeShow="CheckIfShow"
TargetControlID="btnSubmit">
<asp:ValidationSummary ID="ValidationSummary1" runat="server"/>
</telerik:RadToolTip>
</div>
</form>
</body>
</html>
Many thanks for your help...
Fraser
http://demos.telerik.com/aspnet-ajax/tooltip/examples/clientsideapi/defaultcs.aspx
And successfully got this working, but when I tried to use a radbutton instead of a standard asp button I get a microsoft JScript runtime error: Object Expected
Below is my code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="nomastervaltest.aspx.vb"
Inherits="nomastervaltest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<script type="text/javascript">
//<![CDATA[
function HideTooltip() {
var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
if (tooltip) tooltip.hide();
}
function ShowTooltip() {
window.setTimeout(function () {
var tooltip = $find("RadToolTip1");
//API: show the tooltip
tooltip.show();
}, 10);
}
function CheckIfShow(sender, args) {
var summaryElem = document.getElementById("ValidationSummary1");
//check if summary is visible
if (summaryElem.style.display == "none") {
//API: if there are no errors, do not show the tooltip
args.set_cancel(true);
}
}
//]]>
</script>
<asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvCompany" runat="server" ControlToValidate="txtCompany"
Text="!" ErrorMessage="The company name is obligatory!">
</asp:RequiredFieldValidator>
<telerik:RadButton ID="btnSubmit" Text="Submit" runat="server" OnClientClicking="ShowTooltip()">
</telerik:RadButton>
<telerik:RadToolTip runat="server" ID="RadToolTip1" Position="TopRight" HideEvent="ManualClose"
ShowEvent="FromCode" Width="300px" RelativeTo="Element" EnableShadow="true" OnClientBeforeShow="CheckIfShow"
TargetControlID="btnSubmit">
<asp:ValidationSummary ID="ValidationSummary1" runat="server"/>
</telerik:RadToolTip>
</div>
</form>
</body>
</html>
Many thanks for your help...
Fraser