Edit a record in a datgrid : Having to reload the data

I

Iain

Hi All

I have a datagrid which takes it's data from a table on
a remote i-series. This datagrid is loaded on Page Load
and the user is able to select a record to edit by pressing
the appropriate button. No problem so far.

The problem comes in that I appear to have to reload the
data into the datagrid before placing it into editstate.

string LSqlString;
LSqlString = "Select * From ICOSF.LIVLEADTIM";
con.Open();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = LSqlString;
OleDbDataReader dsLivery = cmd.ExecuteReader();
Livery.DataSource = dsLivery;
Livery.EditItemIndex = e.Item.ItemIndex;
Livery.DataBind ( );
con.Close();

This is fine and works. However the problem comes into play in the
following scenario

1. The page loads and reads the table and populates the datagrid.
2. Someone else deleted a record from the source table via some
other process. This record is still visible in the loaded datagrid.
3. My user selects that particular record for editing.
4. The data load is fired off again and the datagrid is placed into
edit mode
this time with the wrong record highlighted for editing - down to
the
selected ItemIndex of the record selected of the original
datagrid.

Anyone have any ides about how I oversome this problem.

Thanks in advance for any help offered

Iain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top