解决方案 »

  1.   

    我问的问题是按上面那段话的意思应该是点击button时,应该是updatepanel中的textbox1的值修改,但是实际上是整个页面都刷新了,而不是部分刷新
      

  2.   

    那个用着是比较麻烦点,现在流行的都是 ajax 来做异步 加载了
    如: $(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);
            }
      

  3.   

     <ContentTemplate>
                    <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>  
    在所示位置加上红色代码
      

  4.   

    不要用微软的那个控件了,用Jquery的ajax不是很简单吗
      

  5.   

    主题加载
      <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 + "秒将停止考试,请及时“提交”试卷,否则试卷作费成绩无效!";
            }
      

  6.   

    lz已经用这个完成90%了,不会采用jquery的ajax+ashx了