Data Grid cell value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

dir sir
I have a problem with the data gri
I want to get the data in the selected cell and store it in a strin
How can I do that??!

thanks si
Mohammed
 
Hi
Use itembound u can get the each and every cell value
private void dgdUserBrowse_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType !=
ListItemType.Footer)

{

((LinkButton)e.Item.Cells[0].Controls[2]).Attributes["onclick"] =
"javascript:return confirm('Delete user. " +
DataBinder.Eval(e.Item.DataItem,"name") + "?')";

}

}


pls check this code

Regards
Venu.
 
Mohammed said:
I have a problem with the data grid
I want to get the data in the selected cell and store it in a string
How can I do that??!!

Are you just trying to get the value of the current cell? If so, you can
use the CurrentCell property of the DataGrid object and get the
RowNumber and ColumnNumber of the cell. Then you can use those with the
DataTable object associated with the DataGrid to get the value. For
example,

Dim dgc As DataGridCell = DataGrid1.CurrentCell
string cellValue = dt.Rows(dgc.RowNumber).Item(dgc.ColumnNumber)

Cheers

Arne Janning
 
Back
Top