Reputation: 3010
What is the difference between command field and template field in grid view and how can I use them in grid view?
I am new in c# so please provide full help so I can feel easy to work with both.
thanks
Upvotes: 2
Views: 1541
Reputation: 67
Templete Field :- If U Want To do Some More Action in GridView Like Editing , Display Images etc Then U Hav To Use Templete Filed.
Upvotes: 0
Reputation: 460208
A CommandField
enables to display command buttons to perform selecting, editing, inserting, or deleting operations in a data-bound control.
A TemplateField
enables to display custom content in a data-bound control. You could for example nest another GridView
inside it or a custom WebUserControl
which consists of several other controls.
So in short:
CommandField
autogenerates a button or link for special actions like edit/deleteTemplateField
is extremely customizable, you can put anything thereUpvotes: 3
Reputation: 411
Template fields are fields where you add controls inside gridview columns. And command fields are the attribute through which you came to know which control has generated event inside girdview.
Upvotes: 2
Reputation: 6123
In template field you can place any asp.net control, you can customize it.
From MSDN:
Represents a field that displays custom content in a data-bound control.
From MSDN:
Represents a special field that displays command buttons to perform selecting, editing, inserting, or deleting operations in a data-bound control.
Upvotes: 1