Reputation: 11
I Implemented the code below it gives a run time error."Input string was not in a correct format".
int ID = int.Parse(grdMnaualEntryTransactionTemplate.SelectedRow.Cells[1].Text)
Upvotes: 0
Views: 764
Reputation: 493
try that
int ID = int.Parse(grdMnaualEntryTransactionTemplate.SelectedRow.Cells[1].Value.ToString())
Or...
int ID = (int)grdMnaualEntryTransactionTemplate.SelectedRow.Cells[1].Value;
Upvotes: 0
Reputation: 2097
You can check this post also. Error can be occurred due to extra spacing. Try to use .Trim() and check.
Upvotes: 1