兄弟,不能这样简单地重新绑定
InputChildDataGrid.DataBind();
ICollection CreateTable()
{
string strSel = "select * from UserList";
DataSet ds = new DataSet(); OleDbDataAdapter MyAdapter = new OleDbDataAdapter(strSel,MyConn);
MyAdapter.Fill(ds,"Score"); return ds.Tables["Score"].DefaultView;
}
public void BindGrid()
{
usrGrid.DataSource = CreateTable();
usrGrid.DataBind();
}public void DataGrid_PageChanged(Object sender,DataGridPageChangedEventArgs e)
{
usrGrid.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
InputChildDataGrid.DataBind();
ICollection CreateTable()
{
string strSel = "select * from UserList";
DataSet ds = new DataSet(); OleDbDataAdapter MyAdapter = new OleDbDataAdapter(strSel,MyConn);
MyAdapter.Fill(ds,"Score"); return ds.Tables["Score"].DefaultView;
}
public void BindGrid()
{
usrGrid.DataSource = CreateTable();
usrGrid.DataBind();
}public void DataGrid_PageChanged(Object sender,DataGridPageChangedEventArgs e)
{
usrGrid.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
解决方案 »
- 求多站点简单布署的思路
- 求Discuz .net版本中的短消息系统。
- CKEditor做的博客发帖页面
- 论坛中的引用该如何实现好?
- 求高手,Request.ServerVariables("SERVER_NAME")和Request.ServerVariables("URL")有什么区别吗
- 关于建立 索引的 问题? 新手求助!
- 问大家一个简单的ASP问题,希望能得到解决。只花您一分钟
- asp.net 中的水晶报表如何去掉参数字段的输入参数提示框???
- vs.net开发环境开发的WEBSERVICE上传到空间时的问题
- 怎样在.net中按一个BUTTON后立即关闭本页,急(在线等),帮帮忙啊
- 一个sql语句的问题
- 急!ASP编程小问题,在线等!!!
你的方法跟我的没有什么区别啊,实现的功能都是一样的。
我的问题是这样的,如果DataGrid绑定数据集后是多页的,比如有两页,当选择第二页时,如果编辑第二页的第三行数据,但是按了“编辑”列后,编辑行出现的数据却是第一页第三行的数据值,执行“更新”后实际是更新的第一页的第三行数据值。
这个该死的东东,我每次问题都出在她这里,
你的问题。我也有过,更糟,我的是删除按钮
{
objStock.GetStockInputChildDS(SBillID,"",SInputChildDS,SSuitID); //获取数据集
InputChildDataGrid.DataSource=SInputChildDS;
InputChildDataGrid.DataBind();
}
{
objStock.GetStockInputChildDS(SBillID,"",SInputChildDS,SSuitID); //获取数据集
InputChildDataGrid.DataSource=SInputChildDS;
InputChildDataGrid.DataBind();
}
InputChildDataGrid.DataBind();
ICollection CreateTable()
{
string strSel = "select * from UserList";
DataSet ds = new DataSet(); OleDbDataAdapter MyAdapter = new OleDbDataAdapter(strSel,MyConn);
MyAdapter.Fill(ds,"Score"); return ds.Tables["Score"].DefaultView;
}
public void BindGrid()
{
usrGrid.DataSource = CreateTable();
usrGrid.DataBind();
}public void DataGrid_PageChanged(Object sender,DataGridPageChangedEventArgs e)
{
usrGrid.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
{
if ( ! this.IsPostBack )
{
ViewState["Edit"] = "0";
this.Bind();
} }
private void YjDataGrid_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ViewState["Edit"] = "1";
YjDataGrid.EditItemIndex = e.Item.ItemIndex;
Bind();
} protected void YjDataGrid_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
YjDataGrid.CurrentPageIndex = e.NewPageIndex;
YjDataGrid.DataBind();
} private void Bind()
{
YjDataGrid.DataSource = m_DataView;
YjDataGrid.DataBind();
Pagination();
}
在多页时,执行删除时也会出现类似的问题,例如在DataGrid的第三页删除第三行的数据,实际是删除第一页的第三行数据,用了以上各位的方法似乎不能解决啊
InputChildDataGrid.DataSource=SInputChildDS;
InputChildDataGrid.EditItemIndex = -1;
InputChildDataGrid.DataBind();