Ammar Asjad
Ammar Asjad

Reputation: 3010

Difference b/w command field and template field

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

Answers (4)

Nikhil Kurkure
Nikhil Kurkure

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

Tim Schmelter
Tim Schmelter

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:

  • a CommandField autogenerates a button or link for special actions like edit/delete
  • a TemplateField is extremely customizable, you can put anything there

Upvotes: 3

Tarun Tak
Tarun Tak

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

Waqar Janjua
Waqar Janjua

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.

Command Field:

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

Related Questions