Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Data Grid view in i take a button column that i want to use As a update button..
But the fact is that i does't know how to Write a code for that
or How to crate a event for it..
i used c# for web application in visual studio 2008
how can i do this,,
I have no idea Can any one help me...
Posted

You can try this for building the update query:

C#
SqlCommandBuilder build = new SqlCommandBuilder(adapter);


and on update record button click event write the below line:

C#
adapter.Update(dt);


here adapter is a object of SqlDataAdapter and dt is object of DataTable. And make sure your table contains Primary key.

refer this to learn more:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx?ppud=4[^]

hope it helps :)

for further queries comment here!!
 
Share this answer
 
v2
go to gridview1_RowUpdating event from the Gridview->properties->events on the header part and write ur code there.....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900