On rowupdating online dating sites 4 teens
In the above tutorial I tried to give you one of the easiest solutions and I hope you can go explore Grid View control editing further after learning the basics from this tutorial.
A friend asked me to help him out on this and frankly it has me completely stumped as well.
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.
By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.
event is raised when a row's Update button is clicked, but before the Grid View control updates the row.
This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.
In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.
These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.
To do this we first need to obtain the reference of the current row by using its index no as shown in the first line below.
In the Page_Load event, you simply load your data from the database and bind it with the Grid View control as shown below: For brevity I am not storing connection string in the web.config and also not using any Data Access Component.
Next event is the Grid View Row Editing event to give ASP. You need to set the Edit Index property of the Grid View with the New Edit Index property of the Grid View Edit Event Args class.
Last line of the following code is calling a local method for updating the database and passing all the parameters to this method.
Please keep in mind that there are many different ways to update the database using the Grid View control depending on the type of data you are updating and the functionality the user need and there are many solutions to achieve the same end result.
By using the Grid View Row object we can find the reference of any control in the row in which user is editing the data.