Updating in gridview
In the same way you can put any kind of Validation controls inside Edit Item Template to validate the form element while user will click Update link.For Page Name and Page Description field I want them to appear in the Text Box in edit view, so I have specified text property of Text Box as the field value in Edit Item Template and for Active field, I want it to appear as the Drop Down List so I have specified the Selected Value property as the value of the Active field.If you have a feedback or suggestion, please do write to me. Full Name: Sheo Narayan Member Level: Honorary Platinum Member Status: Administrator Member Since: 7/8/2008 PMCountry: India Regards, Sheo Narayan MVP, Author, Writer, Mentor & architecting applications since year 2001. What would you do if you wanted to have an event trigger when you click on the "cancel" button during the delete process. When a person starts to delete another item and decides to cancel the delete, the old message from the previously edited or deleted item still shows. ya,its how can I use the button field for the edit and delete in the template field.suppose i used that controls,what kind of events could I used for edit successfully? Connect me on | https://twitter.com/sheonarayan | Hello.... Now let’s start with putting the Grid View on page. Data Key Names="Auto ID" Auto Generate Edit Button="True" On Row Editing="Edit Record" On Row Canceling Edit="Cancel Record" On Row Updating="Update Record" Cell Padding="4" Header Style-Horizontal Align="left" On Row Deleting="Delete Record" Row Style-Vertical Align="Top" Fore Color="#333333" Grid Lines="None" In the above code, I have kept Auto Generate Columns as false so that Grid View will not render all the fields of the data source automatically.I have specified Data Key Names as Auto ID, the primary key of the database table.
With the help row variable, I am going to find all the controls placed under that row in edit mode using Find Control property.
That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).
You can notice that I have kept Required Field Validator too inside the Edit Item Template as I want the textbox to be validated for empty data.
As there is no row at -1 position so Grid View will be shown in normal mode.
When Update link of the Grid View will be clicked (in edit mode), On Row Updating event will fire that will call Update Record method.