Protected void gridview1rowupdating object sender gridviewediteventargs e
We will use Template Field, whenever we want to define some custom control in the data bound controls like Grid View, Data Grid or Data Repeater.
If he clicks edit (or) in the edit mode he can be able to see the Textbox.
In data driven web sites, users are normally allowed to view data and administrators are allowed to add, edit or delete data.
In this tutorial I will show you how you can create an editable Grid View control for administrators to modify database records directly into the Grid View control.
The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.
By default all the boundfields will be trasferred as Textboxes in Edit Mode.
In the template field I will Place a label or some controls, So that it’s very easy to access those controls in the code behind by using Find Control method. Item Template is the content to display for the items in the Template Field.
One note will be helpful for you, while describing Columns in Grid View if you are using a boundfield then create objects of the control using cells[index] in the rowupdateing event of Grid View, but if you are using controls itself like Label or textboxes etc then use Fincontrol("stringid").
How can I make use of them (for the scenario below)?
Scenario: I'm trying to build a custom control with a delete function, and I want to be able to delete the control that was clicked on a page that contains many of the same custom control.
May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.
Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.
The sender is the control that the action is for (say On Click, it's the button).