Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello friend.
i have one problem i want to update gridview data at run time
i am include edit button in the grid view and its working fine even cancel button is also working fine but my update button is not working any one give me c# code for update the data.
for edit button code is : gridview1.editindex=e.neweditindex;
gridview1.datasource = getdata();
gridview1.databind();
for cancel button : gridview1.editindex = -1;
gridview1.datasource = getdata();
gridview1.databind();
can any one give me code for update button so that my data is update in gridview.
Thanks & Regards
Deepak
Posted
Comments
Prasad CM 15-Jun-11 8:45am    
R U using Static DataTable Variable for Loading Data to GridView
Or Data VAlues from Database?...

Mention Which Table Ur Using and their Columns...

thanks friend i had sort out this problem

thanks for reply
 
Share this answer
 
Try
GridView.UpdateRow Method which enable you Updates the record at the specified row index using the field values of the row.
as
void UpdateRowButton_Click(Object sender, EventArgs e)
  {
    // Programmatically update the current record in edit mode.
    CustomersGridView.UpdateRow(CustomersGridView.EditIndex, true);
  }

Take a look there-MSDN(GridView.UpdateRow Method)[^] for more details.
 
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