手动分页:- 下一步按钮
本文关键字:下一步 按钮 分页 | 更新日期: 2023-09-27 18:33:01
在按钮单击事件上,我执行一个新查询,我得到了一个新表,但我无法将其填充到同一网格视图上。有什么原因我可以使用架构而不是数据表。
private void GetData()//This method Displays the Datatable onto the Grid
{
int intCount = 0;
int.TryParse(txt_messagecount.Text, out intCount);
DataTable dtData = null;
//dtData = _objIMRSData.GetData(txt_fromdate.Text, txt_todata.Text, txt_messagecount.Text);
dtData = _objIMRSData.GetTransactionData( txt_fromdate.Text, txt_todata.Text,intCount );
grd_transactionLog.DataSource = dtData;
grd_transactionLog.DataBind();
dtData.Clear();
}
//On Button click event I execute a new query i get a new table
//but i am unable to populate it on to the same grid view
protected void btn_next_Click(object sender, EventArgs e)
{
int messageCount = int.Parse(txt_messagecount.Text);
string lastRecord = grd_transactionLog.Rows[messageCount-1].Cells[1].Text;
DataTable dtData1 = null;
//dtData = _objIMRSData.GetData(lastRecord, txt_todata.Text, txt_messagecount.Text);
dtData1 = _objIMRSData.GetTransactionData(lastRecord, txt_todata.Text, messageCount);
//grd_transactionLog.Columns.Clear();
grd_transactionLog.DataSource = dtData1;
grd_transactionLog.DataBind();
dtData1.Clear();
}
重新分配datasource
。在click
事件中执行此操作。
grd_transactionLog.DataSource = null;
grd_transactionLog.DataSource = dtData1;