Datagrid question

  • Thread starter Thread starter Maziar Aflatoun
  • Start date Start date
M

Maziar Aflatoun

Hi everyone,

Here is my problem. I have a datagrid that I binds to a table with the
following fields.

PID
FirstName
LastName

In my datagrid I display FirstName and LastName along with a edit option
(Don't want to display the PID in my datagrid). I have also enabled sorting
on it as well too. Now I want to enable my users to click on the edit option
of any row and get redirected to another edit page where they can edit the
contents of that record. (all I want to pass is the PID). When I read the
e.Item.ItemIndex it gives me the relative position of the row that was
clicked which is useless after you do a sort. Is it possible to hide a PID
value of individual rows in my datagrid and how would I read it if it is? or
do you know a better way to read the PID of that row once a user clicks on
it?

Basically on my edit page I want to take the PID as a parameter ex.
edit.aspx?PID=''

Thank you
Maz
 
Hi Maz,

You can include the PID column in the datagrid and set its
visible property to false. Then when you click on the edit
button, you can access it's value as

intPID = e.Item.Cells(cellno).Text


HTH.

Kaustav Neogy.
 
Back
Top