0

I am developing a web application and using the ASP.NET ListView control. I am having now a large ListView and I want to minimize the width of it since there are large spaces between the columns. Also, I would like to change the style of it. How to do that?

I googled about this issue but I just found two resources for changing the style without changing the width of it. I tried to add the width to CSS style but I failed, too.

user976711
  • 115
  • 5
  • 16

1 Answers1

0

See MSDN: ListView class, e.g. the Width property:

Style properties are not supported by the ListView control. If you try to set the Width property, a NotSupportedException exception is thrown.

To style the ListView control, you must style the controls inside the ListView templates by using cascading style sheets (CSS) classes or inline style elements.

How are you defining the different templates (ItemTemplate, etc)? You could make use of the Layout template, put a <div> inside and set a fixed (or maximum) width on the <div> with CSS

kaveman
  • 4,339
  • 25
  • 44