3

By default, DetailsView supports 2 columns. I'd like to add a third column. Is this possible using DetailsView? Creating a table within each field doesn't do what I'd like as the third column won't be properly aligned.

I know I can use other controls such as DataList, but having the typed asp:HyperLinkField / asp:CheckBoxField / etc of DetailsView and corresponding properties is extremely convenient.

Does the best of both worlds (the flexibility of DataList and the built-in shorthand objects of DetailsView) exist?

Alex R.
  • 4,664
  • 4
  • 30
  • 40
Mike
  • 297
  • 3
  • 5
  • 13

2 Answers2

4

If you want a custom template & layout, you should use FormView, as it will behave and have the same events as the detailsView.

Take a look at MSDN and Using the FormView's Templates

Off The Gold
  • 1,228
  • 15
  • 28
Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
-1

I'm not sure why you think DetailsView supports only two columns. There's a comprehensive example on MSDN that has multiple columns (fields):

DetailsView Class

Tim
  • 28,212
  • 8
  • 63
  • 76
  • I think you're mixing up columns vs. rows - I know I can add X # of rows / fields, but I believe only 2 columns are supported. If I'm wrong please confirm the syntax, I don't see it in the link you provided – Mike Jul 29 '11 at 03:53
  • I don't see anything in the link that says only two columns are supported; in fact, columns aren't even mentioned, just fields. If you have a row of data, it would seem rather limiting to only be able to display 2 columns/fields from that row. Perhaps I'm misunderstanding what you mean by columns? – Tim Jul 29 '11 at 05:50