VB.Net 2003 DataGrid Cell Selection
-
Hi everyone, I've been trying to select (from the code) a specific cell in the DataGrid control to change it's value. Exemple: if [cell].text = "" then [cell].text = "0" I didn't actually find a way to do that. Can someone help me out? Thanks!
Hi, look at this code, i am checking the cell value when i am binding the data ....and if it is empty, then i am displaying it as '0' hope this will give you some idea resolve your problem!! Private Sub YourDataGridName_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles YourDataGridName.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then If e.Item.Cells(0).text="" then e.Item.Cells(0).text=0 End if end sub Thanks, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "