Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Columns of fixed width
posted

We have a grid where the first two colouns contain a check box and an icon. We need these columns to stay the same width when the window is resized, or when columns are added to or removed from the grid. The other columns should scale to fill the available space.

In HTML this would be easy to do. Simply specify the width for the columns that should change with a star as unit, e.g. width="1*". However, if I write this in our layout XML file, DisplayLayout.LoadLayout throws an ArgumentOutOfRangeException, whch comes ultimately from .NET's Unit class. You might think that setting max-width and min-width on the fixed columns would do the trick, but they have no effect.

Does anybody out there know how to do it?

 

Parents
No Data
Reply
  • 28464
    posted

    Hello Lector,

    Thanks for the question - an interesting one. Unfortunately Height and Width in ASP.NET are of type Unit and the "1*" is not supported on a framework level, so you will get the same result even with a simple textbox, e.g. this is not supported in ASP.NET in general:

            <asp:TextBox runat="server" ID="TextBox1" Width="1*" />

    I think you might be able to do that on the client side with javascript though. You can hook the body.onload event, get the Columns and their respective Html Elements and set width this way directly, or using our CSOM (client side object model) to do that:

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebGrid_Column_Object_CSOM.html

    But then again, this is just a suggestion for a starting point, I really have not tried this and cannot guarantee it will work.

Children