As your Gridview is in its simplest form with no controls defined in the gridview (and hence there is no Currency textbox defined in the GridView), please check the datasource of GridView1 which I assume would be a Datatable.
Then you need to identify which column of the Datatable is the Currency column.
For e.g., for the below datatable, it would be column 2.
DataTable taskTable = new DataTable("AmountList");
taskTable.Columns.Add("Id", typeof(int));
taskTable.Columns.Add("Currency", typeof(string));
taskTable.Columns.Add("Amount", typeof(decimal));
Based on this, you can retrieve your updated Currency value using the following code below.
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = TaskGridView.Rows[e.RowIndex];
GridView1.EditIndex = -1;
TextBox txtCurrency = (TextBox)(row.Cells[2].Controls[0]);
if (!Page.IsPostBack)
{
FillTravelers();
}
//... Rest of the code
}
Please note that if the Currency column is different above, then you need to change the index of rows.Cells[index].Controls[0] too. For e.g., if Currency is at column 5, then the txtCurrency definition becomes:
TextBox txtCurrency = (TextBox)(row.Cells[5].Controls[0]);
If you are not able to figure out the column index of the datatable easily (or if you are using a more complicated datasource), then, assuming the GridView1 does not have too many columns, I would recommend trying to increment the Cells index step by step until you see the updated value in the Watch for row.Cells[index].Controls[0] while debugging.
Edit: (Adding code to retrieve the column index of the Currency column)
You can pass "Currency" as a string and the OracleDataReader instance to the below method and this should give you the column index (or it gives you -1 if there is no Currency column in the OracleDataReader).
private int GetColumnIndexIfExists(OracleDataReader dr, string columnName)
{
for (int i = 0; i < dr.FieldCount; i++)
{
if (dr.GetName(i).Equals(columnName))
{
return i;
}
}
return -1;
}
Then in the actual code, you can modify add 1 to the cell index as shown below because the cell index is not zero based like the column index.
TextBox txtCurrency = (TextBox)(row.Cells[i+1].Controls[0]);