G
Guest
Have a datagrid that displays the price column in this format $12,400.00 from
a table.
Went to the Property Builder of the datagrid and selected the Price column
and changed the Data formatting expression to {0:c}
*********
Have the following code in the DataGrid1_UpdateCommand event handler
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
//Price column
TextBox tb = (TextBox) e.Item.Cells[1].Controls[0];
string stPrice = tb.Text.SubString(1); //this is the decimal number without
the '$'
decimal dc = decimal.Parse(stPrice); //convert string number to decimal
DataSet1.CAR_DETAILRow r;
r = dataSet11.CAR_DETAIL.FindByCAR_ID(int.Parse(key));
r.PRICE=dc; //this line causes problems; in my table the datatype of Price is
//number and I keep getting the error "Input string was
not in a
//correct format."
oracleDataAdapter1.Update(dataSet11);
DataGrid1.DataBind();
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
*******************
Can anyone tell me what I'm doing wrong? I've also tried using
Convert.ToDecimal and still same error message.
Any suggestions would be appreciated.
I'm using c# and oracle9i table
Thanks
bebop
a table.
Went to the Property Builder of the datagrid and selected the Price column
and changed the Data formatting expression to {0:c}
*********
Have the following code in the DataGrid1_UpdateCommand event handler
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
//Price column
TextBox tb = (TextBox) e.Item.Cells[1].Controls[0];
string stPrice = tb.Text.SubString(1); //this is the decimal number without
the '$'
decimal dc = decimal.Parse(stPrice); //convert string number to decimal
DataSet1.CAR_DETAILRow r;
r = dataSet11.CAR_DETAIL.FindByCAR_ID(int.Parse(key));
r.PRICE=dc; //this line causes problems; in my table the datatype of Price is
//number and I keep getting the error "Input string was
not in a
//correct format."
oracleDataAdapter1.Update(dataSet11);
DataGrid1.DataBind();
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
*******************
Can anyone tell me what I'm doing wrong? I've also tried using
Convert.ToDecimal and still same error message.
Any suggestions would be appreciated.
I'm using c# and oracle9i table
Thanks
bebop