62,046
社区成员
发帖
与我相关
我的任务
分享
<asp:AsyncPostBackTrigger ControlID="Time1" EventName="Tick" />
updatepanel有"tick"这事件吗?//判断用户是否存在
function login() {
$.ajax({
type: 'POST', //用POST方式传输
dataType: 'json', //数据格式:JSON
url: 'js/checking.ashx', //目标地址
data: 'name=' + $("#txtName").val(),//文本框里的用户名
//接收数据完毕
success: function(json) {
if (json.verify == '0') {
alert('恭喜您用户名可以注册');
} else if (json.verify == '1') {
alert('用户名已注册');
return false;
}
}
});
string json = string.Empty; //返回给js页面的结果,用于判断
int result = 0; //查询结果
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string email = context.Request["name"]; //获取用户名
//链接数据库查询 .此处自己写
if (result == 0) //result为返回的查询结果
{
json = "{\"verify\":\"0\"}";
context.Response.Write(json);
return;
}
else
{
json = "{\"verify\":\"1\"}";
context.Response.Write(json);
return;
}
}
public bool IsReusable
{
get
{
return IsReusable;
}
}
<body>
<form id="Form1" method="post" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<zgw:ZedGraphWeb ID="ZedGraphWeb1" runat="server" Width="1000" Height="340">
</zgw:ZedGraphWeb>
<asp:Timer ID="Time1" runat="server" Interval="10000" Enabled="true" OnTick="Time1_Tick">
</asp:Timer>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Time1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
<zgw:ZedGraphWeb ID="ZedGraphWeb1" runat="server" Width="1000" Height="340">是一个画图的控件,下面是对应的cs文件 protected void Page_Load(object sender, EventArgs e)
{
drawingPicture();
}
protected void drawingPicture(...参数略)
{
//逻辑略
}
protected void Time1_Tick(object sender, EventArgs e)
{
Response.Write("dddddddddddddddddddddddddddddddd");
drawingPicture();
}