hi,
How to perform Edit,Delete operation in Grid view using Asp.net 2.0 in visual studio 2005?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Purushottam RathorePosted Nov 18, 2009, 4:59 AM
Kirtan PatelPosted Nov 16, 2009, 7:29 AM
Here is Simplest Way to Do that Without Writing Single Line of Code :) . if you are Beginner then this will be help full to you .
friend, if my answer helps you then please check "Do you like this answer check box" :)
Bind Your Database table With GridView by Click On SmartTag which is on the Right Top Corner of the GridView
then Select the DataSource From there .
Now In Grid
Step 1 (Click On Samrt Tag As Show Below )
Step 2
While Selecting the DataSource Click On Advance Sql Option button and Check Generate Insert Update Delete Check box
Step 3
Now In SmartTag You Will Have New Options Enable Editing and Delete .Check Them Both
Step 4
you are Done!!
Now your Grid Allow you to Update and delete the DataRows :)
keshav singhPosted Nov 16, 2009, 7:05 AM
this will help you
please mark it as Accepted
Amit ChoudharyPosted Nov 4, 2009, 8:24 AM
Hi, Here is the instructions for you problem....
Implementing a Delete, Insert and Update operations you must have a DataAdapter and define its Delete, Insert and Update commands. You could use this adapter against your datasource and call the adapters' update method...
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM table1", conn);
adapter.InsertCommand = new SqlCommand("INSERT INTO table1 VALUES(@param1, @param2)", conn);
adapter.InsertCommand.Parameters.Add("@param1",...);
Just do the same to the Update and Delete commands. Then, Create a DataSet and Fill it using the adapter and make it as a datasource of your datagrid...
DataSet ds = new DataSet();
adapter.Fill(ds);
DataGrid1.DataSource = ds;
When you want to send your changes to the database you can just call the adapter.update method...
adapter.Update(ds);
========================================
if it helps you mark it as answer..please it'll help me getting some points :)