How To Update A Column In A DataGrid Using C#.NET? I am getting InvalidCastException as (Specified cast is not valid) while updating 2nd column in a datagrid? Id,firstname,lastname are the three columns of my datagrid respectively. I wanted to edit the second column(lastname) and update it. I did the following code in DataGrid's updatecommand(),but failed to update ! Int varid=(int)DataGrid1.DataKeys[e.Item.ItemIndex]; TextBox lnm=(TextBox)e.Item.Cells[2].Controls[0]; string str=lnm.Text ; SqlCommand cmd=new SqlCommand("update customer set lastname='" + str + "' where id=" + varid + "",con); cmd.ExecuteNonQuery(); DataGrid1.EditItemIndex=- 1; DataGrid1.DataBind();
2 14633Post New Mind Tree ADO.NET Interview Questions
How do we do testing in tableau?
Explain Active power,reactive power,how its related to each other , & inductive ,capacitive.
Can you please explain the difference between parent() and parents() methods in jquery? : jquery mobile
What is sessionfactory in hibernate?
Tell me is it possible to remove the html tags from data?
Explain the extern storage classes in c++.
What is OOP Language?
Is struts 1 still supported?
Diff b/w Health care domain and Banking Domain?
What can you contribute to Pizza Express?
What is DevOps culture?
describe one of your memorable day? how is education useful for any body?
How to give face effect in jquery?
What is a fall back class?
Why should you be preferred over others?