These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.
I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.
If you want to edit 3rd Row then set the Edit Index to 2 (Row index starts from 0,1,2..). Find Control(“txt Emp Name”) as Text Box; Text Box txtdesign = dg Employees. Custom Delete in Grid View For Delete register Row Command event of the gridview.
After setting editindex refresh the grid by calling Bin Grid. Find the Unique id for deleting the row from Data Keys collection of gridview.
NET Grid View markup and associated code lets first enumerate the important code pieces of this tutorial.
In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.
Set the data bindings for Delete Button for Command Argument Eval(“Emp Id”); for saving the ID column value from database for fetching the ID field value while Deleting the Record.
Set the Command Name property to Delete Button to CMDDelete. Value); Place the Textbox control in the grids Footer template for Adding new record. Register events for Edit, Update, Cancel button of gridview ?? View in Grid View To view data in gridview is very simple. Ts Fill method and set the Grid Views Data Source Property to Data Set.
It covers most of the basic reports for which you do not need any reporting component like Crystal Report, Report Viewer etc.Set the Binding Field name to the Text Property of both controls for each template field to the respective Database Column Name i.e Eval(“Emp Name”).Set the Data Key Names property of Grid View to Primary Key Column of Data Base i.e. This property binds the database column field value to each row of gridview as a Unique Identifier.In this event we have to handle the Delete Button Code. Edit Index specifies which row is in edit mode by setting Row Index to it.Instead if you are using default Delete Button of Grid View then register for Row Deleting event of Grid View and for accessing Unique ID columnvalue from database you need to fetch the id from Data Keys collection of Grid View. By default Edit Index of gridview is -1 (Normal mode). Find Control(“txt Designation”) as Text Box; Finally update the row and refresh the grid.