Questions tagged [templatefield]
182 questions
29
votes
7 answers
How to find Control in TemplateField of GridView?
How does FindControl method works if I need to find any Control which is inside GridView Template, more specifically ItemTemplate?
I have a hyperlink but it is not able to find the same.
Question updated with code
GridView Code is…

xorpower
- 17,975
- 51
- 129
- 180
26
votes
9 answers
How to use HtmlEncode with TemplateFields, Data Binding, and a GridView
I have a GridView bound to an ObjectDataSource. I've got it supporting editing as well, which works just fine. However, I'd like to safely HtmlEncode text that is displayed as we do allow special characters in certain fields. This is a cinch to…

Sean Hanley
- 5,677
- 7
- 42
- 53
12
votes
5 answers
Binding the Checked Property of a CheckBox within a TemplateItem
For the life of me I cannot bind the Checked property of a CheckBox control within a TemplateField (declaritively).
I have tried:

Frinavale
- 3,908
- 10
- 44
- 74
11
votes
2 answers
ASP:DropDownList in ItemTemplate: Why is SelectedValue attribute allowed?
This piece of code

recursive
- 83,943
- 34
- 151
- 241
10
votes
3 answers
ASP.NET + GridView + CommandField as TemplateField
I have a GridView. My GridView has a column that is contains an "Options" column. This column includes the traditional CommandField options (edit, delete, etc.). I have the code setup to work when a CommandField is used. However, I need to do some…

user70192
- 13,786
- 51
- 160
- 240
9
votes
2 answers
Gridview sorting with custom template fields
I can't seem to figure out how to sort my gridview with both databound AND
custom fields.
The custom field look like this:
c#
asp.net
gridview
sorting
templatefield

Mark
- 91
- 1
- 1
- 2
8
votes
5 answers
How to get values from template fields in GridView?
This is my markup of GridView.
…

Sandeep
- 278
- 1
- 6
- 21
7
votes
3 answers
How to Sort on a GridView using ObjectDataSource with TemplateFields
Background:
I am working with a GridView and an ObjectDataSource. I am implementing Paging and Sorting.
On the ObjectDataSource:
objectDataSource.TypeName = value;
objectDataSource.SelectMethod = "Select";
…

Jonathan Mitchem
- 953
- 3
- 13
- 18
6
votes
3 answers
Asp Gridview use Boundfields? or Templatefields?
I put data in a data table e.g.
dt.TableName = "SA1";
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Now I'm not sure if I should use boundfield (For all columns)

Jack
- 526
- 3
- 10
- 30
5
votes
4 answers
Cannot get values from textboxes in templateField inside of gridview
Sorry about the code earlier. Could anyone please help?
I have a gridview GridView1 which is populated on PageLoad() by importing from Excel sheet that has three columns:
Date
Customers
PayingBookNoOrDD
The sheet has five rows. Users can edit the…

Amol
- 127
- 1
- 7
5
votes
1 answer
ASP:LinkButton and Eval
I'm using an ASP:LinkButton inside of an ItemTemplate inside of a TemplateField in a GridView. For the command argument for the link button I want to pass the ID of the row from the datasource that the gridview is bound to, so I'm doing something…

sgibbons
- 3,620
- 11
- 36
- 31
5
votes
2 answers
"Update/Cancel" buttons don't appear in TemplateField Edit button
When you create an edit button in every row of a Gridview using CommandField it displays update/cancel buttons after clicking, so you can accept/cancel changes.
However, I want an edit button that has tooltip text, and since CommandField doesn't…

phalanx
- 497
- 5
- 17
- 33
5
votes
1 answer
how do I add a CheckBox to a TemplateField HEADER?
I have this:

JJ.
- 9,580
- 37
- 116
- 189
4
votes
1 answer
Replacing HeaderText with Headertemplate in TemplateField
I have a gridview with templatefield columns. The TemplateFields are something like this:

NavidM
- 1,515
- 1
- 16
- 27
4
votes
3 answers
How to pass GridView row to TemplateField function?
I have a GridView that has 3 columns: FirstName, LastName and a TemplateField FullName where I string together FirstName and LastName.
Assuming calling DisplayFullName is the function I want to use to concatenate FirstName and LastName, how do I…

RJIGO
- 1,903
- 7
- 22
- 31