Questions tagged [templatefield]

182 questions
3
votes
1 answer

Dynamically Add TemplateField to Details View

I have a grid view that, on selected index, will populate a details view. If the selected index happens to have multiple IP Address's I want to add additional fields to display them. They don't need to be databound since I know the data. I'm using…
Will
  • 989
  • 4
  • 19
  • 33
3
votes
2 answers

CheckBox in ASP.NET GridView template field does not retain it's value on submit

I'm trying to use CheckBoxes within a GridView's TemplateField to select multiple entries from that GridView. The GridView's data source is a list of items that is generated at page load.
Catalin Florea
  • 468
  • 8
  • 16
3
votes
5 answers

Getting total values of a certain column from GridView

Him I am using a ASP.NET/VB.NET with SQL-Server-2012. I have a a GridView column with 3 fields and 1 template field as shown below:
Brian
  • 1,951
  • 16
  • 56
  • 101
3
votes
2 answers

Gridview loses ItemTemplate after columns are removed

I'm trying to bind a datatable to a gridview where I've removed some of the autogenerated columns in the code behind. I've got two template columns and it seems that when I alter the gridview in code behind and remove the non-templated columns that…
Middletone
  • 4,190
  • 12
  • 53
  • 74
3
votes
3 answers

Can I programmatically add a linkbutton to gridview?

I've been looking through some similar questions without any luck. What I'd like to do is have a gridview which for certain items shows a linkbutton and for other items shows a hyperlink. This is the code I currently have: public void…
pschorf
  • 519
  • 1
  • 10
  • 23
2
votes
1 answer

Adding TemplateField to DetailsView

How do I add TemplateField control to the beginning of the DetailsView Fields collection? Here is my code.. TemplateField tf = new TemplateField(); ... ... dv.Fields.Add(tf); This adds to the very end of the DetailsView control. I tried…
dotnet-practitioner
  • 13,968
  • 36
  • 127
  • 200
2
votes
1 answer

C# - ASP.NET - Calendar Control - Specified cast is not valid

I have a gridview where I keep track of deadlines. I have 2 dates herefor. A expected date (date where the deadline is supposed to be completed) and an actual date (date where the deadline was completed). Now in my DB all the expected dates have…
KevinP
  • 217
  • 1
  • 5
  • 20
2
votes
2 answers
2
votes
2 answers

Getting values from templatefields gridview - C#

I am using a gridview to display a table queried from a database... In this gridview I also added a buttonfield, and 3 template fields... When i press the buttonfield the data from the database is acquired, but the manual data inserted from the…
cgval
  • 1,096
  • 5
  • 14
  • 31
2
votes
1 answer

Simplifying ItemTemplate output of `GridView` to regular

I'm using a TemplateField for a column because I need the HeaderTemplate. However, the ItemTemplate renders the content of a cell as an and the output looks like this: data Is there any way to make the…
frenchie
  • 51,731
  • 109
  • 304
  • 510
2
votes
1 answer

How to write a custom templatefield-like DataControlField

I am using a GridView to display data where one of the data columns has type DateTimeOffset. In order to display dates & times in the user's timezone, I save the user's timezone preference to his or her profile (property value key "TimezoneOffset"),…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
2
votes
5 answers

Dynamically enable asp button based on datasource value

SOLVED: See my solution below! using aspx with C# code behind. I have the following code in a button in a item template in a gridview: Enabled='<%# IIF(Eval("wrqst_need_ind") == "Y","TRUE","FALSE") %>' I am getting the following error: The name…
kralco626
  • 8,456
  • 38
  • 112
  • 169
2
votes
1 answer

Binding data to a textbox , inside a templatefield of a gridview » C# and ASP.NET

How can I bind data to a textbox which is in a templatefield of a gridview ? I want to use ExecuteScalar , get a value and throw it to that textbox .
lglifesgood
  • 51
  • 1
  • 4
2
votes
1 answer

Passing more than one argument in asp.net button in gridview

I have a TemplateField column in a gridview with a button inside of it. There is NO key value (surely that was not designed by me) , but in the other hand there aren't redundancies when comparing each single column, because they are events, and…
Marcelo
  • 3,371
  • 10
  • 45
  • 76