以XMLHttpRequest方式填入DataGrid
来源:互联网 发布:java io继承图 编辑:程序博客网 时间:2024/06/03 00:15
古老的AJAX做法...
DataGrid只能看,不能用...
JavaScript Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var client= null ;
if (window.XMLHttpRequest){
client = new XMLHttpRequest();
}
else if (window.ActiveXObject){
client = new ActiveXObject( "Microsoft.XMLHTTP" );
}
function getDataGrid(app_date)
{
try
{
var url= "Grid.aspx" ;
url=url+ '?app_data=' +document.getElementById( 'app_data' ).value;
client.open( "GET" , url);
client.onreadystatechange = callBack;
client.send();
}
catch (ex)
{
alert(ex.message);
}
}
function callBack(response)
{
try
{
if (client.readyState == 4 && client.status == 200 )
{
document.getElementById( "GridSection" ).innerHTML=client.responseText;
}
}
catch (ex)
{
alert(ex.message);
}
}
if (window.XMLHttpRequest){
client = new XMLHttpRequest();
}
else if (window.ActiveXObject){
client = new ActiveXObject( "Microsoft.XMLHTTP" );
}
function getDataGrid(app_date)
{
try
{
var url= "Grid.aspx" ;
url=url+ '?app_data=' +document.getElementById( 'app_data' ).value;
client.open( "GET" , url);
client.onreadystatechange = callBack;
client.send();
}
catch (ex)
{
alert(ex.message);
}
}
function callBack(response)
{
try
{
if (client.readyState == 4 && client.status == 200 )
{
document.getElementById( "GridSection" ).innerHTML=client.responseText;
}
}
catch (ex)
{
alert(ex.message);
}
}
C# Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
protected void Page_Load( object sender, System.EventArgs e)
{
if (! this .IsPostBack)
{
if (Request[ "app_data" ] != null )
{
this .SetBind(( string )Request[ "app_data" ]);
}
}
}
//取得主DataGrid畫面資料
private void SetBind( string app_data)
{
//資料
DataTable Store = Operator.getDataGridDataSource(app_date).Tables[ 0 ];
DataView StoreView = new DataView(Store);
GridCS.DataSource = StoreView;
GridCS.DataBind();
//將Grid寫到網頁
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Response.ClearHeaders();
Response.Clear();
Response.Charset = "UTF-8" ;
GridCS.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
}
{
if (! this .IsPostBack)
{
if (Request[ "app_data" ] != null )
{
this .SetBind(( string )Request[ "app_data" ]);
}
}
}
//取得主DataGrid畫面資料
private void SetBind( string app_data)
{
//資料
DataTable Store = Operator.getDataGridDataSource(app_date).Tables[ 0 ];
DataView StoreView = new DataView(Store);
GridCS.DataSource = StoreView;
GridCS.DataBind();
//將Grid寫到網頁
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Response.ClearHeaders();
Response.Clear();
Response.Charset = "UTF-8" ;
GridCS.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
}
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 以XMLHttpRequest方式填入DataGrid
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 《一》以支持多种浏览器的方式创建 XMLHttpRequest 对
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- 以支持多种浏览器的方式创建 XMLHttpRequest 对象
- xmlHttpRequest 以Post方式发数据到Asp.net页,在gb2312编码下的解决办法
- 使用T_sql语句向其中一次填入一条数据或一次填入多条数据的方式填入数据。
- xmlhttprequest生成方式
- Comet4J(Comet for Java)是一个纯粹基于AJAX(XMLHTTPRequest)的服务器推送框架,消息以JSON方式传递
- XMLHttpRequest的POST方式发送
- 根據datagrid模板列中的checkbox填入日期至textbox有解嗎?10/17
- XMLHttpRequest 异步方式和同步方式
- XMLHttpRequest 异步方式和同步方式
- DataGrid传统分页方式
- MVC Razor视图引擎
- VB.NET 操作xml
- 安装SQL server出现的问题及解决方法
- 静夜思
- 我做的思维导图(大学物理基础导航)
- 以XMLHttpRequest方式填入DataGrid
- linux如何清空终端内容
- 驴与农夫的故事
- 直接拿来用!最火的Android开源项目(一)
- [工作问题总结]支持IE 6 7 8 9 上下固定 中间自适应
- Windows 下以非阻塞方式读取标准输入
- word生成目录右对齐
- C# Winform 按ESC关闭窗体
- Java bubble sort