how to add edit update inside asp.net gridview

Nueykolqdzxdl

New Member
I have a gridView and i have written it's Edit & Update statement with my own ,but the problem i have i can't convert two of gridview textbox which are assigned to BirthDate(datatype=date)and average(datatype=decimal) , and now when i debugg the solution this message is appeared:The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.and somethig the same message for average.my code i have written is as below:\[code\]protected void Grid_Updating(object sender, GridViewUpdateEventArgs e) { SqlCommand cmd = DataProvider.GenerateCommand("Update_HowzeEducation_SP", CommandType.StoredProcedure); cmd.Connection.Open(); cmd.Parameters.Add("@FieldName", SqlDbType.NVarChar).Value = http://stackoverflow.com/questions/12795604/((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text; cmd.Parameters.Add("@FinishLevelDate", SqlDbType.Date).Value = http://stackoverflow.com/questions/12795604/Convert.ToDateTime(((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.Trim()); cmd.Parameters.Add("@Average", SqlDbType.Decimal).Value = http://stackoverflow.com/questions/12795604/decimal.parse(((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text); cmd.Parameters.Add("@SchoolName", SqlDbType.NVarChar).Value = http://stackoverflow.com/questions/12795604/((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text; cmd.Parameters.Add("@StudyCityDescribtion", SqlDbType.NVarChar).Value = http://stackoverflow.com/questions/12795604/((TextBox)GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text; cmd.Parameters.Add("@ThesisTitle", SqlDbType.NVarChar).Value = http://stackoverflow.com/questions/12795604/((TextBox)GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text; cmd.Parameters.Add("@Describtion", SqlDbType.NVarChar).Value = http://stackoverflow.com/questions/12795604/((TextBox)GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text; cmd.Parameters.Add("@HowzeEducationId", SqlDbType.Int).Value = http://stackoverflow.com/questions/12795604/GlobalVariables.HowzeEducationId; cmd.ExecuteScalar(); }\[/code\]
 
Back
Top