ankurg

ankurg

  • NA
  • 2
  • 0

How to retrieve Value of a Primary Key from a DataGrid

Jul 22 2004 1:10 AM
Hi I am new to the use of DataGrids. People with experience please help me. I am working on a C#.Net desktop application and I have a DataSet("ds") with a table ("strTableName") and i am showing that Table in a DataGrid. Also Table has a primary key field. I have bound the Table to datagrid by these lines: dataGrid1.DataSource=ds.Tables[strTableName].DefaultView; dataGrid1.SetDataBinding(ds,ds.Tables[strTableName]); No what i wish to do is that when User selects a "row" on the DataGrid , i need to retrieve the primary key of the row that user selects. I think there is a DataKeys property in ASP.Net but i wasnt able to find that property in the right context menu of the datagrid1. So what shud i do to retrieve the primary key value of the selected row. Please help..Thanks in Advance... Regards Ankur

Answers (1)