S
Simon
Guys,
I'm populating a dataset and displaying the data in a
datagrid. Then, when the procedure ends the data
disappears. Obviously, this isn't very useful. Any ideas
why this is happening?
Thanks,
Simon.
(code below)
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
// Attempt 1.
////DataAdapter1.Fill(DataSet1);
////DataGrid1.DataBind();
// Attempt 2.
Connection1.Open();
DataAdapter1.Fill(DataSet1);
DataGrid1.DataSource = DataSet1;
DataGrid1.DataBind();
Connection1.Close();
// At this point I still have data, either way.
}
}
My webpage displays, then I click Button1:
private void Button1_Click(object sender, System.EventArgs
e)
{
// No data in dataset here.
MessageBox.Show(Dataset1.Tables
[0].Rows.Count.ToString());
}
I'm populating a dataset and displaying the data in a
datagrid. Then, when the procedure ends the data
disappears. Obviously, this isn't very useful. Any ideas
why this is happening?
Thanks,
Simon.
(code below)
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
// Attempt 1.
////DataAdapter1.Fill(DataSet1);
////DataGrid1.DataBind();
// Attempt 2.
Connection1.Open();
DataAdapter1.Fill(DataSet1);
DataGrid1.DataSource = DataSet1;
DataGrid1.DataBind();
Connection1.Close();
// At this point I still have data, either way.
}
}
My webpage displays, then I click Button1:
private void Button1_Click(object sender, System.EventArgs
e)
{
// No data in dataset here.
MessageBox.Show(Dataset1.Tables
[0].Rows.Count.ToString());
}