网上可以说对Ajax谈得热火朝天,最近也没什么项目就去看了一下,并写了个关于pop提示框的小程序

运行结果如下

首次使用Ajax

文件说明

popwin.js:弹出提示框的js文件无须改动(这是公用的)

Ajax.dll  :这是Ajax组件

源代码
在Ajax中最可惜的是不能绑定DataGrid服务端控件
在用DataGrid时只能这么写

[Ajax.AjaxMethod()]
  public string  GetAjaxTable()
  {
   try
   {
    DataTable dt=new DataTable();
    SalesManagerQuery m_SalesManagerQuery=new SalesManagerQuery();
    dt=m_SalesManagerQuery.getSales();
    //DataGrid1.DataSource=dt;
    //DataGrid1.DataBind();

    //DataGrid dg = new DataGrid();
    dg.DataSource=dt;
    dg.DataBind();
    dg=DataGrid1;
    DataGrid1.Visible=false;
    System.Text.StringBuilder strb = new System.Text.StringBuilder();
    System.IO.StringWriter sw = new System.IO.StringWriter( strb );
    System.Web.UI.HtmlTextWriter htw = new HtmlTextWriter( sw );
    dg.RenderControl( htw );
    string s = strb.ToString();
    return s;
   }
   catch(Exception ex)
   {
    throw ex;
   }
  }

相关文章:

  • 2021-08-24
  • 2021-09-29
  • 2022-01-12
  • 2022-02-17
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-09-22
  • 2021-06-02
相关资源
相似解决方案