How can i add, delete, update using datagrid?currently, im using Sql Server as the database.
That highly depends on whether you meant Windows Forms or Web forms.
If you're using .net 2.0, use GridView, not DataGrid.
it is windows form. i know, the binding navigator can be used to add, delete, but i had to used button. so i didnt know how to add or delete without using the binding navigator. can anyone help me?
here is a sample code: modify according to ur need
this is for update task
TextBox tb1=new TextBox();
TextBox tb2=new TextBox();
TextBox tb3=new TextBox();
i think rest of the operations are easy.
if u r using indexing then u may have a problem in deleting a record when there is a single record in datagrid or in page.these 2 are diferent problems.if u hav this prob then ask me.
thanks for ur reply, but for the update task, i already know the code. right now, i m having problem for adding data because it involves master detail relationship and i have to add the data from text box and also datagrid.
just access the datagrid control value by findcontrol method by passing the id of the control in that.i think this is a sql problem rather than a grid problem.can u tell me in detail abt ur problem.