62,269
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="deleteWebApplication5._Default" %>
<!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">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<%= DateTime.Now %>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace deleteWebApplication5
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, typeof(UpdatePanel), "alert", "alert('测试警告');", true);
//ScriptManager.RegisterClientScriptBlock(this.Page, Page.GetType(), "alert", "alert('测试警告');", true);
}
}
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('当前已是最后一页!')</script>");
protected void LinkButton2_Click(object sender, EventArgs e)
{
Session["date"] = Convert.ToInt32(Session["date"]) - 10;
if (Convert.ToInt32(Session["date"]) > 0)
{
-----创建一个表格
}
else
{
this.LinkButton1.OnClientClick = "return alert('当前已是最后一页!')";
return;
}
}