Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a gridview dynamically.i want to add buttons for edit ,update and delete in the code behind.i searched but couldn't find a solution.
Posted

You can have the Grid default Add / Edit / Delete column in the grid and hide and show based on your need.

-Maheswaran.S
 
Share this answer
 
Comments
Malayali Coder 17-Nov-14 4:34am    
i want to add the button for it and its event from code behind
 
Share this answer
 
I used the autoGenerateEditButton function of gridview.


C#
 protected void Page_Load(object sender, EventArgs e)
        {
viewgrid.AutoGenerateEditButton = true;
viewgrid.RowEditing += new GridViewEditEventHandler(viewTable_RowEditing);
}

 void viewTable_RowEditing(object sender, GridViewEditEventArgs e)
        {
          
            viewTable.EditIndex = e.NewEditIndex;
            filldata();
        }
 
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