解决方案 »
- DataTable常用操作分享
- 程序未完成循环就结束是什么问题?
- 急急急,数据库数据恢复
- GridView中有DropDownList导出Excell时把它给替换掉,出了一点问题
- 为什么这个正则表达式是错误啊
- 大家帮看一下下面两段代码,为什么第一个不能实现textbox输出,第二个能实现?
- "Specified cast is not valid"这个异常谁遇到过?
- 关于Session的一个问题
- gridview绑定问题
- vs.net crystalreport display
- 请教大家关于A标签的href属性,其中网址问号后面怎么加自定义变量。
- 以数据驱动开发的信息管理系统中,接口和抽象类有什么作用?
如: $(document).ready(function() {
$("#btnSubmit").click(function() {
$.ajax({
//要用post方式
type: "POST",
anync: true, //true为异步
//方法所在页面和方法名
url: "getsyslogdata.ashx?tag=1",
cache: false,
//contentType: "application/json; charset=utf-8",
data: { "starttime": starttime, "endtime": endtime, "type": type },
//"{ 'starttime':'" + starttime + "', 'endtime':'" + endtime + "', 'type':'" + type + "' }",
//"starttime=" + starttime + "&endtime=" + endtime + "&type=" + type,
dataType: "json",
success: function(data) {
//返回的数据用data.d获取内容
num = data;
val = parseFloat(num);
progressbar.progressbar("value", val);
if (val >= 100) {
clearInterval(sh);
}
},
error: function(err) {
//alert(err);
}
});
});
});
然后,你可以建一个ashx的一般应用程序public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string tag = context.Request["tag"].Trim();
string result = "";
if (tag.Equals("0"))
{
result = GetNum();
}
if (tag.Equals("1"))
{
string starttime = context.Request["starttime"].Trim();
string endtime = context.Request["endtime"].Trim();
string type = context.Request["type"].Trim();
result = GetData(starttime, endtime, type);
} if (tag.Equals("2"))
{
string name = context.Request["filename"].Trim();
result = UploadFile(name);
} context.Response.Write(result);
}
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
在所示位置加上红色代码
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="3000" ontick="Timer1_Tick">
</asp:Timer>
在线考试题:时间设置
<br />
<asp:Label ID="lbTime" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
二:处理页面
private int index
{
get
{
object o = ViewState["index "];
return (o == null) ? 600 : (int)o;
}
set
{
ViewState["index "] = value;
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
this.index--;
if (this.index == 0) //考试时间到了
{
this.Timer1.Enabled = false;//设置Timer控件不可见
//时间到时,此处可编写自动提交试卷的方法
}
else
{
//显示考试剩余时间
this.lbTime.Text = this.index / 60 + "分" + this.index % 60 + "秒将停止考试,请及时“提交”试卷,否则试卷作费成绩无效!";
}