Asp.net DetailsView - multiple columns?

Mike picture Mike · Jul 26, 2011 · Viewed 10.7k times · Source

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?

Answer

Muhammad Akhtar picture Muhammad Akhtar · Jul 26, 2011

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