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 16089Post New Mind Tree ADO.NET Interview Questions
How do I exit the wrapper?
What is codebase?
Explain why the name ‘hadoop’?
state your three strengths.
Which operator in perl is used for the concatenation of two strings?
can we extend a class having only one parameterised constructor.Suggest the process to do it.
What is page request in asp.net?
What is the maximum size of array?
Describe Cell culture contaminations ?
Difference between depreciation according to cost principle and matching principle
Explain the use of NLP in legal research.
Explain Basic Steps in Writing a Java Program Using Jdbc?
How to classified pagination in bootstrap?
Which service does the html $compile service use for the purpose of data binding?
What is the purpose of autoloader in zend framework?