A program about get value from datagrid cell

J

Jet

Hi,all
I have a asp.net programme,and it include a datagrid contorl in it.And all
the data from the datagrid is come from a access mdb.And I had use like
<$#DataBinder.Eval(Containter.DataItem,"name")%> to binding data. And in
this datagrid control there is a delete command , when I active this command
I want to get the value of column 2 in this row and the visable of this
column is false.How can I get it?
I had try the code like this,but can't get any value .
private int DataGrid1_DeleteCommand(object source,DataGridCommandEventArgs
e){
int i=e.Item.Cells[1].Text;
}
How can I get the select cell's value in current selected row?
 
M

melk

Hi!

You can get all the value directly from the dataSource table...

If you felt datagrid with a datatable, you can write this on your "del
event":

DataTable dt = (DataTable)yourDataGrid.dataSource;
int itemId = e.Item.ItemIndex + (yourDataGrid.CurrentPageIndex *
yourDataGrid.PageSize);

int i = dt[itemId]["id"];

now you have all the records... hidden too!!!

bye

Melk
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top