P
Pearl.Elevation
Hi, I am just beginning to learn to use the .Net framework and recently
I confront a problem with the datagrid.
I create an .asp file. There are two buttons, one datagrid on the
screen.
The first button is "Show" button. When I click this button, it will
call the data in the sql Server and bind the data to the datagrid. The
code is:
ArrayList alErrorIn = new ArrayList();
DataTable dtBookAdmin =
objBOBookAminManipulation.GetBookAdminsInterface(out alErrorIn);
dgBookAdmin.DataSource = dtBookAdmin;
dgBookAdmin.DataBind();
It works fine.
The second button is "Delete" button. There is a template colum in the
datagrid. When I choose the item and click the "Delete" button, the
corresponding items in the datagrid will be deleted. But it won't work
fine. When I debug, I check the datagrid before I do the delete:
private void btnDelete_Click(object sender, System.EventArgs e)
{
int iCount = dgBookAdmin.Items.Count;
ArrayList alDeleteid = new ArrayList();
foreach(DataGridItem dataGridItem in dgBookAdmin.Items)
....
But the iCount show that there is no item in the datagrid. But there
are items showed in the screen and I check the value after I have bind
the data to the datagrid, it's fine.
So I get confused. Could anyone clear my problem? Thank you very much!
I confront a problem with the datagrid.
I create an .asp file. There are two buttons, one datagrid on the
screen.
The first button is "Show" button. When I click this button, it will
call the data in the sql Server and bind the data to the datagrid. The
code is:
ArrayList alErrorIn = new ArrayList();
DataTable dtBookAdmin =
objBOBookAminManipulation.GetBookAdminsInterface(out alErrorIn);
dgBookAdmin.DataSource = dtBookAdmin;
dgBookAdmin.DataBind();
It works fine.
The second button is "Delete" button. There is a template colum in the
datagrid. When I choose the item and click the "Delete" button, the
corresponding items in the datagrid will be deleted. But it won't work
fine. When I debug, I check the datagrid before I do the delete:
private void btnDelete_Click(object sender, System.EventArgs e)
{
int iCount = dgBookAdmin.Items.Count;
ArrayList alDeleteid = new ArrayList();
foreach(DataGridItem dataGridItem in dgBookAdmin.Items)
....
But the iCount show that there is no item in the datagrid. But there
are items showed in the screen and I check the value after I have bind
the data to the datagrid, it's fine.
So I get confused. Could anyone clear my problem? Thank you very much!