现在的位置: 首页 > 综合 > 正文

Use Refresh() function right in WebGrid with javascript

2012年07月25日 ⁄ 综合 ⁄ 共 608字 ⁄ 字号 评论关闭

First ,make sure that you had added BindData code in InitializeDataSource(object sender, DataSourceEventArgs e) Event .
Sample code:
protected void WebGrid1_InitializeDataSource(object sender, DataSourceEventArgs e)
{
  DataTable dt=method.GetDataTable();
  e.DataSource = dt;
}

And then  you can invoke Refresh() funtion with javascript .
sample code:
function  Refresh()
 {
    var grid = ISGetObject("WebGrid1");
    grid.Refresh();
 }

BTW,You also can Perform refresh on the particular table only, without refreshing the whole tables (root table and child tables).
sample code:
function refreshChild() {
        var grid = ISGetObject("WebGrid1");
        grid.Tables[tablename].Refresh();

抱歉!评论已关闭.