应用dot net的ajax举例-简单的对话代码
来源:互联网 发布:java 当前时间加一天 编辑:程序博客网 时间:2024/06/04 22:46
<!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>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="Button1" EventName ="Click" ></asp:AsyncPostBackTrigger >
</Triggers>
</asp:UpdatePanel>
输入聊天信息:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 选择字体颜色:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>红色</asp:ListItem>
<asp:ListItem>绿色</asp:ListItem>
<asp:ListItem>黄色</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="发送" onclick="Button1_Click" />
</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 综合实例
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Application.Set("Msg", "" + Application["Msg"] + "<br><font color=red size=4>" + Request.UserHostName + "进入聊天室</font>[<font size=2>" + DateTime.Now.ToString() + "</font>]");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Application.Set("Msg", Application["Msg"] + "<br><font color=" + DropDownList1.Text + " size=4>" + Request.UserHostName + "说:" + TextBox1.Text + "</font> [<font size=2>" + DateTime.Now.ToString() + "</font>]");
}
protected void Timer1_Tick(object sender, EventArgs e)
{
try
{
Label1.Text = Application["Msg"].ToString();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
}
- 应用dot net的ajax举例-简单的对话代码
- Dot net 正则表达式的应用
- 梦幻Dot Net的代码生成器
- Menu应用的简单举例
- ajax实现简单的机器人对话
- Dot Net的调试 - 1
- Dot Net的调试 - 2
- Dot Net的调试 - 3
- Java & Dot Net的遐思
- Dot Net的调试 - 2
- Dot Net的调试 - 1
- Dot Net的调试 - 2
- Dot Net的调试 - 1
- Dot Net Framework的发展过程
- VB.net中反射的应用举例
- find和grep的简单应用举例
- ajax的简单应用
- ajax的简单应用
- java入门教程-3.8再谈Java包
- Spring注解原理的详细剖析与实现
- POJ 3087 解题报告
- Oracle中ltrim的用法
- 安卓常用权限设置
- 应用dot net的ajax举例-简单的对话代码
- java入门教程-3.9Java源文件的声明规则
- 第六次作业
- ISO8583接口的详细资料
- AIX sshd提示fatal: mm_memvalid: address too large: ffff0000
- 《锋利的jQuery》笔记-jQuery部分
- SQL 函数
- SELECT FILE
- 开发者应警惕的七种糟糕职业规划错误