Gridview edit mode rowupdating
When the Edit Button is clicked, the reference of the Grid View row is determined and the Label controls is made hidden while the Text Box controls are made visible in the Name and Country columns of the Grid View control.When the Update Button is clicked, the reference of the Grid View row is determined and the updated values are fetched from the respective Text Boxes of Name and Country columns while the Customer Id is determined from the Customer Id column."Item Template" property is used to control the appearance of a data item and "Edit Item Template" property is used to control the appearance of a data item in Edit mode. So here what I have done is, User ID is the primary key. For all other columns there is a "Edi Item Template".And in "Item Template", I have used a Label to display the value. And in "Edi Item Template", I have used a Text Box to display value, because it should be editable.The editable fields of the row will change into edit mode and the "Edit" button will disappear.Instead of "Edit" button, three more buttons will come to the picture which will be "Update","Delete" and "Cancel".This is becoming so frustrating it's getting almost comical. Breakpoints were triggered for the Row Editing and Row Command. David I suggested that the Row Updating function was being blocked by the . Data Bind() in the Row Command event so that only the Edit command will activate it (take it out of Row Editing). Twice for Row Command (1 for Row Editing and 1 for Row Canceling) and once for Row Editing. I am going to try and create this not as a web application but rather as a website and see if I notice any differences.
The Text Box will be made visible while performing Edit and Update operations in the Grid View.I have used image buttons here to make the UI bit nicer. Then I am assigning that row number to Grid View's Edit Index property which will put the appropriate row into the Edit Mode.