日期:2014-05-18  浏览次数:20627 次

ajaxpro的使用问题
我的项目中使用了ajaxpro是为了加载页面时,显示“请稍等……”,但在后台的方法中绑定gridview去不显示数据。这是我的代码
页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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>
  <script language="JavaScript" type="text/JavaScript">  
  <!--  
  function Working() { //v3.0 \
  
  var a=_Default.aaa(aa)
  alert(a);
  }  
  function aa()
  {
  document.getElementById("div2").style.display="none";
  document.getElementById("div1").style.display="";
  }
  //-->  
  </script>
</head>
<body onload="Working()">
  <form id="form1" runat="server"><div id="div2" runat="server" style="z-index: 1; left: 430px; position: absolute;
  top: 245px;">
  <input type="image" src="busy.gif" />
  &nbsp;&nbsp;请稍等……
  </div>
  <div id="div1" >
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
  <Columns>
  <asp:BoundField DataField="name" HeaderText="name" />
  <asp:BoundField DataField="sex" HeaderText="sex" />
  <asp:BoundField DataField="mark4" HeaderText="mark4" />
  <asp:BoundField DataField="year4" HeaderText="year4" />
  </Columns>
  <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
  <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
  <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
  <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
  <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
  <AlternatingRowStyle BackColor="White" />
  </asp:GridView>
  <asp:DropDownList ID="DropDownList1" runat="server">
  </asp:DropDownList></div>
  </form>
</body>
</html>
后台
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
  protected void Page_Load(object sender, EventArgs e)
  {
  AjaxPro.Utility.RegisterTypeForAjax
  (typeof(_Default));
  if (!IsPostBack)
  {