RadToolTip (点击按钮,弹出ToolTip)

 

ContractedBlock.gif ExpandedBlockStart.gif View Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="WebApplication.Demo" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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 id="Head1" runat="server">
<title></title>
<style type="text/css">
.toolTipStyle
{
background
-color: #ECEDE5;
}
</style>
<script type="text/javascript" src="../Common/Js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript">

/************************弹出ToolTip*************************/
var toHide
= false;

function OnClientBeforeHide(sender, args) {
if (!toHide) args.set_cancel(true);
}

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest
(
function (sender, args) {
toHide
= false;
if (args.get_postBackElement().id == "btnAdd") {
var tooltip
= $find("<%=RadToolTip1.ClientID%>");
tooltip.show();
}
var tooltip
= $find("<%=RadToolTip1.ClientID%>");
tooltip.show();
}
);
function GetActiveToolTip() {
var tooltip
= Telerik.Web.UI.RadToolTip.getCurrent();
return tooltip;
}
//关闭ToolTip
function CloseToolTip() {
var tooltip
= GetActiveToolTip();
if (tooltip != null && tooltip.get_id() == "RadToolTip1") {
toHide
= true;
tooltip.hide();
}
}
</script>
<div style="text-align: center">
<asp:Button ID="btnAdd" runat="server" Text="新增" ToolTip="新增" />
</div>
<telerik:RadToolTip ID="RadToolTip1" runat="server" Modal="true" ShowEvent="FromCode"
Position
="Center" RelativeTo="BrowserWindow" OnClientBeforeHide="OnClientBeforeHide"
EnableShadow
="true" HideEvent="FromCode" Width="400" Height="200" Animation="Resize"
CssClass
="toolTipStyle">
<asp:UpdatePanel runat="server" ID="UpdatePanel2">
<ContentTemplate>
<asp:Panel ID="pStopCusTrack" runat="server" Style="padding-left: 5px;" CssClass="toolTipStyle"
Height
="200">
<center>
<table>
<tr>
<th colspan="3">
学生信息
</th>
</tr>
<tr style="height: 10px">
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td align="right">
<asp:Literal ID="lStuName" runat="server" Text="学生姓名:"></asp:Literal>
</td>
<td align="left">
<asp:TextBox ID="txtStuName" runat="server" Width="90%"></asp:TextBox>
</td>
<td>
<b style="color: Red; text-align: center;">*</b>
<asp:RequiredFieldValidator ID="rfvStuName" runat="server" Display="None" ControlToValidate="txtStuName"
ValidationGroup
="Save" ErrorMessage="学生姓名不能为空!"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Literal ID="lStuSex" runat="server" Text="性别:"></asp:Literal>
</td>
<td align="left">
<asp:RadioButtonList ID="rblStuSex" runat="server" RepeatColumns="2" Width="90%">
<asp:ListItem Text="" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="" Value="0"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
</td>
</tr>
<tr>
<td align="right">
<asp:Literal ID="lStuAge" runat="server" Text="年龄:"></asp:Literal>
</td>
<td align="left">
<telerik:RadNumericTextBox ID="rntbStuAge" runat="server" MinValue="0" MaxValue="100"
EmptyMessage
="请输入年龄!" NumberFormat-DecimalDigits="0" Width="90%">
</telerik:RadNumericTextBox>
</td>
<td align="left">
<b style="color: Red;">*</b>
<asp:RequiredFieldValidator ID="rfvStuAge" runat="server" Display="None" ControlToValidate="rntbStuAge"
ValidationGroup
="Save" ErrorMessage="年龄不能为空!"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Literal ID="lBirthday" runat="server" Text="出生日期:"></asp:Literal>
</td>
<td align="left">
<asp:TextBox ID="txtBirthday" runat="server" onfocus="WdatePicker({isShowClear:true,readOnly:true})"
Width
="90%"></asp:TextBox>
</td>
<td>
<b style="color: Red;">*</b>
<asp:RequiredFieldValidator ID="rfvBirthday" runat="server" Display="None" ControlToValidate="txtBirthday"
ValidationGroup
="Save" ErrorMessage="出生日期不能为空!"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Literal ID="lAddress" runat="server" Text="家庭住址:"></asp:Literal>
</td>
<td align="left">
<asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" Width="90%"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="btnSave" runat="server" Text="保存" ToolTip="保存" ValidationGroup="Save" />
&nbsp;
<input type="button" onclick="CloseToolTip()" title="关闭" value="关闭" />
</td>
</tr>
</table>
</center>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</telerik:RadToolTip>
<asp:ValidationSummary ID="vsValidation" ValidationGroup="Save" runat="server" ShowMessageBox="true"
ShowSummary
="false"></asp:ValidationSummary>
</form>
</body>
</html>

转载于:https://www.cnblogs.com/ywblog/archive/2011/09/14/2176252.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值