Datagrid Problems

  • Thread starter Thread starter Calson33
  • Start date Start date
C

Calson33

I created a datagrid with an edit button which redirects to another
page for editing. This seemed to work fine. Then, I added a way to
search which just modified the SQL by adding a WHERE clause (I know,
it's going to be put into a stored proc, just trying to get it to work
for now).
This also seemed to work... Until I clicked on the edit button. It
brings up the wrong record.
I tried
mygrid.DataKeys[e.Item.ItemIndex].ToString()
and then I put the primary key into a column, and tried
e.Item.Cells[0].Text
which also brings up the wrong primary key. The really wierd thing is
that the correct primary key is displayed in the column.

Can anyone help me?
 
Is it ASP.NET you are talking about (your redirection statement seems to
indicate that)?
If it is, what event are you using the e.Item.ItemIndex in (i.e. what is
the type of the parameter e)?
 
Back
Top