when deleting a row from a datagrid how do i get the cell ( 0 ) value

  • Thread starter Shaminda Illangantilaka
  • Start date
S

Shaminda Illangantilaka

when deleting a row from a datagrid how do i get the cell ( 0 ) value of the
spcific row, to put that value inside the SQL statement under the WHERE
condition
 
S

Sonu Kapoor

Cell 0 is usually the column which contains the delete/update buttons. I am
assuming that you have an ID and want to delete with the ID in the where
clause. For that purpose I suggest to set the ID in the DataKeyField property
and retrieve it in the delete command via:
DataGrid1.DataKeys(e.Item.ItemIndex) which you can use for your SQL.


--
Sonu Kapoor - [MCP]
ASP.NET Moderator
WebSite: http://www.Kapoorsolutions.com
Blog: http://www.Kapoorsolutions.com/blog/
ASP.NET News: http://www.Kapoorsolutions.com/reblogger/
 
S

Shaminda Illangantilaka

Yes, Thanks for the info..I will try that..

Sonu Kapoor said:
Cell 0 is usually the column which contains the delete/update buttons. I
am
assuming that you have an ID and want to delete with the ID in the where
clause. For that purpose I suggest to set the ID in the DataKeyField
property
and retrieve it in the delete command via:
DataGrid1.DataKeys(e.Item.ItemIndex) which you can use for your SQL.


--
Sonu Kapoor - [MCP]
ASP.NET Moderator
WebSite: http://www.Kapoorsolutions.com
Blog: http://www.Kapoorsolutions.com/blog/
ASP.NET News: http://www.Kapoorsolutions.com/reblogger/


Shaminda Illangantilaka said:
when deleting a row from a datagrid how do i get the cell ( 0 ) value of
the
spcific row, to put that value inside the SQL statement under the WHERE
condition
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top