.net+AjaxPro 分页出现 "请求在此上下文中不可用" 错误。
请知道的各路侠士帮忙!分不多,小弟先谢谢了!

解决方案 »

  1.   

    StringBuilder strList = new StringBuilder();
                //判断是否存在数据记录
                if (nRecCount > 0)
                {
                    //确定数据记录要显示的页数
                    if (nRecCount % pagesize == 0)
                        nPageCount = nRecCount / pagesize;
                    else
                        nPageCount = nRecCount / pagesize + 1;
                    if (nPage < 1)
                        nPage = 1;
                    else if (nPage > nPageCount)
                        nPage = nPageCount;                //确认当前页面的开始记录和终止记录
                    nStart = pagesize * (nPage - 1);
                    if (nRecCount >= pagesize * nPage)
                        nEnd = pagesize * nPage;
                    else
                        nEnd = nRecCount;
                    for (int i = nStart; i < nEnd; i++)
                    {
                       strList.Append("<ul>\n");
                        strList.Append("<li><a href=\"\">\n");
                        strList.Append("<img height=\"65\" width=\"65\" src='" + this.UserFilePath + ds.Tables[0].Rows[i]["SiteLogo"].ToString() +
                                        "alt='"+ds.Tables[0].Rows[i]["SiteName"].ToString()+"'>\n");
                        strList.Append("</a>\n");
                        strList.Append("<p>\n");
                        strList.Append("<a href=\"\">\n");
                        strList.Append(ds.Tables[0].Rows[i]["SiteName"].ToString());
                        strList.Append(" </a>\n");
                        strList.Append("<br />" + ds.Tables[0].Rows[i]["UserCount"].ToString() + "个");
                        strList.Append("</p>\n");
                        strList.Append("</li>\n");
                        strList.Append("</ul>\n");                }
                    strList.Append("<div style='float:right;clear:both;'>共" + nPageCount.ToString() + "页  |  ");
                    strList.Append("<a href=\"javascript:void(0);\" onclick=\"PageOnChange('1')\">首页</a> ");
                    strList.Append("<a href=\"javascript:void(0);\" onclick=\"PageOnChange('" + (nPage - 1).ToString() + "')\">上一页</a>");                for (int i = 1; i <= nPageCount; i++)
                    {
                        if (i == nPage)
                            strList.Append(" " + i.ToString() + " ");
                        else
                            strList.Append(" [<a href=\"javascript:void(0);\" onclick=\"PageOnChange('" + i.ToString() + "')\">" + i.ToString() + "</a>] ");
                    }
                    strList.Append("<a href=\"javascript:void(0);\" onclick=\"PageOnChange('" + (nPage + 1).ToString() + "')\">下一页</a> ");
                    strList.Append("<a href=\"javascript:void(0);\" onclick=\"PageOnChange('" + nPageCount.ToString() + "')\">尾页</a></div> ");
                }
                return strList.ToString();
      

  2.   

    [AjaxMethod(HttpSessionStateRequirement.ReadWrite)]
            public string GetGoalMemberList(int nPage)
            {
                return BindData(nPage);
            }
      

  3.   

    <script type="text/javascript">     
         
         function PageOnChange(nPage)
         {
            UareWeb.Goal.GoalScheduleList.GetGoalScheduleList(nPage,PageOnChange_callback);
         }
         function PageOnChange_callback(res)
         {      
            if(res.value!="")
            {
                document.getElementById("div_ScheduleList").innerHTML = res.value;
            }
         }
        </script>
      

  4.   

    正常。我是改用IHttpCallbackEventHandler接口
    htttp://cx888.myrice.com